test/test_command.rb in cri-2.0.0 vs test/test_command.rb in cri-2.0.1
- old
+ new
@@ -22,11 +22,11 @@
$stdout.puts args.join(',')
opts_strings = []
opts.each_pair { |k,v| opts_strings << "#{k}=#{v}" }
- $stdout.puts opts_strings.join(',')
+ $stdout.puts opts_strings.sort.join(',')
end
end
end
def bare_cmd
@@ -113,11 +113,11 @@
def test_invoke_simple_with_opts
out, err = capture_io_while do
simple_cmd.run(%w(-c -b x))
end
- assert_equal [ 'Awesome moo!', '', 'ccc=true,bbb=x' ], lines(out)
+ assert_equal [ 'Awesome moo!', '', 'bbb=x,ccc=true' ], lines(out)
assert_equal [], lines(err)
end
def test_invoke_simple_with_missing_opt_arg
out, err = capture_io_while do
@@ -187,11 +187,11 @@
nested_cmd.run(%w( s ))
end
end
assert_equal [ ], lines(out)
- assert_equal [ "super: 's' is ambiguous:", " sub sink" ], lines(err)
+ assert_equal [ "super: 's' is ambiguous:", " sink sub" ], lines(err)
end
def test_invoke_nested_with_alias
out, err = capture_io_while do
nested_cmd.run(%w( sup ))
@@ -209,10 +209,10 @@
assert_equal [ 'super:666', 'Sub-awesome!', '', 'aaa=666' ], lines(out)
assert_equal [ ], lines(err)
end
def test_help_nested
- help = nested_cmd.subcommands.to_a[0].help
+ help = nested_cmd.subcommands.find { |cmd| cmd.name == 'sub' }.help
assert_match /^usage: super sub \[options\]/, help
end
def test_help_for_bare_cmd