From 8d9f5628eda4f1353c2578900b6396a7e06f281b Mon Sep 17 00:00:00 2001 From: Daniel Bovensiepen Date: Thu, 1 Nov 2012 16:24:52 +0800 Subject: Add Test for String#bytes --- test/t/string.rb | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'test/t') diff --git a/test/t/string.rb b/test/t/string.rb index 27af38a4c..1a917b1c4 100644 --- a/test/t/string.rb +++ b/test/t/string.rb @@ -339,3 +339,10 @@ assert('Check the usage of a NUL character') do "qqq\0ppp" end +assert('String#bytes') do + str1 = "hello" + bytes1 = [104, 101, 108, 108, 111] + + str1.bytes == bytes1 +end + -- cgit v1.2.3 From b9cf5045b7e10ad722475a432db4fe1b38987cbd Mon Sep 17 00:00:00 2001 From: Daniel Bovensiepen Date: Thu, 1 Nov 2012 16:40:31 +0800 Subject: Add Test for String#each_byte --- test/t/string.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'test/t') diff --git a/test/t/string.rb b/test/t/string.rb index 1a917b1c4..26b7df584 100644 --- a/test/t/string.rb +++ b/test/t/string.rb @@ -346,3 +346,13 @@ assert('String#bytes') do str1.bytes == bytes1 end +assert('String#each_byte') do + str1 = "hello" + bytes1 = [104, 101, 108, 108, 111] + bytes2 = [] + + str1.each_byte {|b| bytes2 << b } + + bytes1 == bytes2 +end + -- cgit v1.2.3 From 308b41c12b3095a5dec85ca89d32a5b196434141 Mon Sep 17 00:00:00 2001 From: Yukihiro Matsumoto Date: Fri, 2 Nov 2012 08:02:21 +0900 Subject: add test for 8cf42709 --- test/t/syntax.rb | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'test/t') diff --git a/test/t/syntax.rb b/test/t/syntax.rb index 7898a0b7d..47221d425 100644 --- a/test/t/syntax.rb +++ b/test/t/syntax.rb @@ -45,3 +45,16 @@ assert('Abbreviated variable assignment', '11.4.2.3.2') do c += 2 a == 1 and b == nil and c == 3 end + +assert('Nested const reference') do + module Syntax4Const + CONST1 = "hello world" + class Const2 + def const1 + CONST1 + end + end + end + Syntax4Const::CONST1 == "hello world" and + Syntax4Const::Const2.new.const1 == "hello world" +end -- cgit v1.2.3