summaryrefslogtreecommitdiff
path: root/test/-ext-
diff options
context:
space:
mode:
Diffstat (limited to 'test/-ext-')
-rw-r--r--test/-ext-/test_scan_args.rb24
1 files changed, 12 insertions, 12 deletions
diff --git a/test/-ext-/test_scan_args.rb b/test/-ext-/test_scan_args.rb
index f6c863e..cb2dab5 100644
--- a/test/-ext-/test_scan_args.rb
+++ b/test/-ext-/test_scan_args.rb
@@ -102,7 +102,7 @@ class TestScanArgs < Test::Unit::TestCase
assert_equal([0, nil, {b: 1}], Bug::ScanArgs.opt_hash(b: 1))
assert_equal([1, "a", {b: 1}], Bug::ScanArgs.opt_hash("a", b: 1))
assert_raise(ArgumentError) {Bug::ScanArgs.opt_hash("a", "b")}
- assert_raise(ArgumentError) {Bug::ScanArgs.opt_hash("a"=>0, b: 1)}
+ assert_equal([1, {"a"=>0}, {b: 1}], Bug::ScanArgs.opt_hash("a"=>0, b: 1))
end
def test_lead_opt_hash
@@ -112,7 +112,7 @@ class TestScanArgs < Test::Unit::TestCase
assert_equal([2, "a", "b", {c: 1}], Bug::ScanArgs.lead_opt_hash("a", "b", c: 1))
assert_equal([1, {c: 1}, nil, nil], Bug::ScanArgs.lead_opt_hash(c: 1))
assert_raise(ArgumentError) {Bug::ScanArgs.lead_opt_hash("a", "b", "c")}
- assert_raise(ArgumentError) {Bug::ScanArgs.lead_opt_hash("a", "b"=>0, c: 1)}
+ assert_equal([2, "a", {"b"=>0}, {c: 1}], Bug::ScanArgs.lead_opt_hash("a", "b"=>0, c: 1))
end
def test_var_hash
@@ -120,7 +120,7 @@ class TestScanArgs < Test::Unit::TestCase
assert_equal([1, ["a"], nil], Bug::ScanArgs.var_hash("a"))
assert_equal([1, ["a"], {b: 1}], Bug::ScanArgs.var_hash("a", b: 1))
assert_equal([0, [], {b: 1}], Bug::ScanArgs.var_hash(b: 1))
- assert_raise(ArgumentError) {Bug::ScanArgs.var_hash("a"=>0, b: 1)}
+ assert_equal([1, [{"a"=>0}], {b: 1}], Bug::ScanArgs.var_hash("a"=>0, b: 1))
end
def test_lead_var_hash
@@ -131,7 +131,7 @@ class TestScanArgs < Test::Unit::TestCase
assert_equal([1, "a", [], {c: 1}], Bug::ScanArgs.lead_var_hash("a", c: 1))
assert_equal([1, {c: 1}, [], nil], Bug::ScanArgs.lead_var_hash(c: 1))
assert_equal([3, "a", ["b", "c"], nil], Bug::ScanArgs.lead_var_hash("a", "b", "c"))
- assert_raise(ArgumentError) {Bug::ScanArgs.lead_var_hash("a", "b"=>0, c: 1)}
+ assert_equal([2, "a", [{"b"=>0}], {c: 1}], Bug::ScanArgs.lead_var_hash("a", "b"=>0, c: 1))
end
def test_opt_var_hash
@@ -142,7 +142,7 @@ class TestScanArgs < Test::Unit::TestCase
assert_equal([1, "a", [], {c: 1}], Bug::ScanArgs.opt_var_hash("a", c: 1))
assert_equal([0, nil, [], {c: 1}], Bug::ScanArgs.opt_var_hash(c: 1))
assert_equal([3, "a", ["b", "c"], nil], Bug::ScanArgs.opt_var_hash("a", "b", "c"))
- assert_raise(ArgumentError) {Bug::ScanArgs.opt_var_hash("a", "b"=>0, c: 1)}
+ assert_equal([2, "a", [{"b"=>0}], {c: 1}], Bug::ScanArgs.opt_var_hash("a", "b"=>0, c: 1))
end
def test_lead_opt_var_hash
@@ -154,7 +154,7 @@ class TestScanArgs < Test::Unit::TestCase
assert_equal([1, {c: 1}, nil, [], nil], Bug::ScanArgs.lead_opt_var_hash(c: 1))
assert_equal([3, "a", "b", ["c"], nil], Bug::ScanArgs.lead_opt_var_hash("a", "b", "c"))
assert_equal([3, "a", "b", ["c"], {d: 1}], Bug::ScanArgs.lead_opt_var_hash("a", "b", "c", d: 1))
- assert_raise(ArgumentError) {Bug::ScanArgs.lead_opt_var_hash("a", "b", "c"=>0, d: 1)}
+ assert_equal([3, "a", "b", [{"c"=>0}], {d: 1}], Bug::ScanArgs.lead_opt_var_hash("a", "b", "c"=>0, d: 1))
end
def test_opt_trail_hash
@@ -165,7 +165,7 @@ class TestScanArgs < Test::Unit::TestCase
assert_equal([2, "a", "b", {c: 1}], Bug::ScanArgs.opt_trail_hash("a", "b", c: 1))
assert_equal([1, nil, {c: 1}, nil], Bug::ScanArgs.opt_trail_hash(c: 1))
assert_raise(ArgumentError) {Bug::ScanArgs.opt_trail_hash("a", "b", "c")}
- assert_raise(ArgumentError) {Bug::ScanArgs.opt_trail_hash("a", "b"=>0, c: 1)}
+ assert_equal([2, "a", {"b"=>0}, {c: 1}], Bug::ScanArgs.opt_trail_hash("a", "b"=>0, c: 1))
end
def test_lead_opt_trail_hash
@@ -178,7 +178,7 @@ class TestScanArgs < Test::Unit::TestCase
assert_equal([3, "a", "b", "c", nil], Bug::ScanArgs.lead_opt_trail_hash("a", "b", "c"))
assert_equal([3, "a", "b", "c", {c: 1}], Bug::ScanArgs.lead_opt_trail_hash("a", "b", "c", c: 1))
assert_raise(ArgumentError) {Bug::ScanArgs.lead_opt_trail_hash("a", "b", "c", "d")}
- assert_raise(ArgumentError) {Bug::ScanArgs.lead_opt_trail_hash("a", "b", "c"=>0, c: 1)}
+ assert_equal([3, "a", "b", {"c"=>0}, {c: 1}], Bug::ScanArgs.lead_opt_trail_hash("a", "b", "c"=>0, c: 1))
end
def test_var_trail_hash
@@ -190,7 +190,7 @@ class TestScanArgs < Test::Unit::TestCase
assert_equal([1, [], {c: 1}, nil], Bug::ScanArgs.var_trail_hash(c: 1))
assert_equal([3, ["a", "b"], "c", nil], Bug::ScanArgs.var_trail_hash("a", "b", "c"))
assert_equal([3, ["a", "b"], "c", {c: 1}], Bug::ScanArgs.var_trail_hash("a", "b", "c", c: 1))
- assert_raise(ArgumentError) {Bug::ScanArgs.var_trail_hash("a", "b", "c"=>0, c: 1)}
+ assert_equal([3, ["a", "b"], {"c"=>0}, {c: 1}], Bug::ScanArgs.var_trail_hash("a", "b", "c"=>0, c: 1))
end
def test_lead_var_trail_hash
@@ -202,7 +202,7 @@ class TestScanArgs < Test::Unit::TestCase
assert_equal([2, "a", [], "b", {c: 1}], Bug::ScanArgs.lead_var_trail_hash("a", "b", c: 1))
assert_equal([3, "a", ["b"], "c", nil], Bug::ScanArgs.lead_var_trail_hash("a", "b", "c"))
assert_equal([3, "a", ["b"], "c", {c: 1}], Bug::ScanArgs.lead_var_trail_hash("a", "b", "c", c: 1))
- assert_raise(ArgumentError) {Bug::ScanArgs.lead_var_trail_hash("a", "b", c: 1, "c"=>0)}
+ assert_equal([3, "a", ["b"], {"c"=>0}, {c: 1}], Bug::ScanArgs.lead_var_trail_hash("a", "b", c: 1, "c"=>0))
end
def test_opt_var_trail_hash
@@ -214,7 +214,7 @@ class TestScanArgs < Test::Unit::TestCase
assert_equal([2, "a", [], "b", {c: 1}], Bug::ScanArgs.opt_var_trail_hash("a", "b", c: 1))
assert_equal([3, "a", ["b"], "c", nil], Bug::ScanArgs.opt_var_trail_hash("a", "b", "c"))
assert_equal([3, "a", ["b"], "c", {c: 1}], Bug::ScanArgs.opt_var_trail_hash("a", "b", "c", c: 1))
- assert_raise(ArgumentError) {Bug::ScanArgs.opt_var_trail_hash("a", "b", "c"=>0, c: 1)}
+ assert_equal([3, "a", ["b"], {"c"=>0}, {c: 1}], Bug::ScanArgs.opt_var_trail_hash("a", "b", "c"=>0, c: 1))
end
def test_lead_opt_var_trail_hash
@@ -226,6 +226,6 @@ class TestScanArgs < Test::Unit::TestCase
assert_equal([3, "a", "b", [], "c", nil], Bug::ScanArgs.lead_opt_var_trail_hash("a", "b", "c"))
assert_equal([3, "a", "b", [], "c", {c: 1}], Bug::ScanArgs.lead_opt_var_trail_hash("a", "b", "c", c: 1))
assert_equal([4, "a", "b", ["c"], "d", nil], Bug::ScanArgs.lead_opt_var_trail_hash("a", "b", "c", "d"))
- assert_raise(ArgumentError) {Bug::ScanArgs.lead_opt_var_trail_hash("a", "b", "c", "d"=>0, c: 1)}
+ assert_equal([4, "a", "b", ["c"], {"d"=>0}, {c: 1}], Bug::ScanArgs.lead_opt_var_trail_hash("a", "b", "c", "d"=>0, c: 1))
end
end