diff options
| author | Daniel Bovensiepen <[email protected]> | 2013-06-14 23:57:09 +0800 |
|---|---|---|
| committer | Daniel Bovensiepen <[email protected]> | 2013-06-14 23:57:09 +0800 |
| commit | c5d116f9c2eb866114642f3e94d3494a5818f8e4 (patch) | |
| tree | 762043722845ab8b6fe5f6569b17889f9f6bc097 | |
| parent | 34cd70b1c5fabc3e3a4f6a705c2bcb3a78fd7ab9 (diff) | |
| download | mruby-c5d116f9c2eb866114642f3e94d3494a5818f8e4.tar.gz mruby-c5d116f9c2eb866114642f3e94d3494a5818f8e4.zip | |
Improve Syntax Tests
| -rw-r--r-- | test/t/syntax.rb | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/test/t/syntax.rb b/test/t/syntax.rb index 0501608e5..332cfcca8 100644 --- a/test/t/syntax.rb +++ b/test/t/syntax.rb @@ -1,9 +1,6 @@ assert('super', '11.3.4') do - test = false - begin + assert_raise NoMethodError do super - rescue NoMethodError - test = true end class SuperFoo @@ -23,18 +20,14 @@ assert('super', '11.3.4') do end end bar = SuperBar.new - test &&= bar.foo - test &&= (bar.bar(1,2,3) == [1,2,3]) - test + + assert_true bar.foo + assert_equal bar.bar(1,2,3), [1,2,3] end assert('yield', '11.3.5') do - begin + assert_raise LocalJumpError do yield - rescue LocalJumpError - true - else - false end end @@ -43,7 +36,10 @@ assert('Abbreviated variable assignment', '11.4.2.3.2') do b &&= 1 c = 1 c += 2 - a == 1 and b == nil and c == 3 + + assert_equal a, 1 + assert_nil b + assert_equal c, 3 end assert('Nested const reference') do @@ -55,8 +51,8 @@ assert('Nested const reference') do end end end - Syntax4Const::CONST1 == "hello world" and - Syntax4Const::Const2.new.const1 == "hello world" + assert_equal Syntax4Const::CONST1, "hello world" + assert_equal Syntax4Const::Const2.new.const1, "hello world" end assert('Abbreviated variable assignment as returns') do @@ -67,5 +63,5 @@ assert('Abbreviated variable assignment as returns') do end end end - Syntax4AbbrVarAsgnAsReturns::A.new.b == 1 + assert_equal Syntax4AbbrVarAsgnAsReturns::A.new.b, 1 end |
