tests/go_test.rb in tins-1.19.0 vs tests/go_test.rb in tins-1.20.0

- old
+ new

@@ -56,7 +56,22 @@ def test_concatenated_argument_at_end r = go 'ab:e:', args = %w[-a -bhello] assert_equal({ 'a' => 1, 'b' => 'hello', 'e' => nil }, r) assert_equal [], args end + + def test_defaults + r = go('bv:', args = %w[ -v bar ], defaults: { ?b => true, ?v => 'foo' }) + assert_equal({ ?b => 1, 'v' => 'bar' }, r) + assert_equal [], args + r = go('bv:', args = %w[ -b -v bar ], defaults: { ?b => 22, ?v => 'foo' }) + assert_equal({ ?b => 23, 'v' => 'bar' }, r) + assert_equal [], args + r = go('bv:', args = %w[ -b ], defaults: { ?b => false, ?v => 'foo' }) + assert_equal({ ?b => 1, 'v' => 'foo' }, r) + assert_equal [], args + r = go('bv:', args = %w[ ], defaults: { ?b => false, ?v => 'foo' }) + assert_equal({ ?b => false, 'v' => 'foo' }, r) + assert_equal [], args + end end end