diff options
| author | Daniel Bovensiepen <[email protected]> | 2012-11-08 17:23:51 +0900 |
|---|---|---|
| committer | Daniel Bovensiepen <[email protected]> | 2012-11-08 17:23:51 +0900 |
| commit | e1e369470eb41453cb79abdbbbdb9158489e2d26 (patch) | |
| tree | 0e4dce8c16af6f8519869a71c9c44f3ee2f3595b /test/t | |
| parent | cdb72a05a294eb8521dd40c011160228496312cb (diff) | |
| parent | 1c95f4eb82d525d7d5eacd214904d262554bf93d (diff) | |
| download | mruby-e1e369470eb41453cb79abdbbbdb9158489e2d26.tar.gz mruby-e1e369470eb41453cb79abdbbbdb9158489e2d26.zip | |
Merge new change
Diffstat (limited to 'test/t')
| -rw-r--r-- | test/t/string.rb | 17 | ||||
| -rw-r--r-- | test/t/syntax.rb | 13 |
2 files changed, 30 insertions, 0 deletions
diff --git a/test/t/string.rb b/test/t/string.rb index 27af38a4c..26b7df584 100644 --- a/test/t/string.rb +++ b/test/t/string.rb @@ -339,3 +339,20 @@ 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 + +assert('String#each_byte') do + str1 = "hello" + bytes1 = [104, 101, 108, 108, 111] + bytes2 = [] + + str1.each_byte {|b| bytes2 << b } + + bytes1 == bytes2 +end + 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 |
