test/test_command.rb in cri-2.5.0 vs test/test_command.rb in cri-2.6.0
- old
+ new
@@ -83,11 +83,10 @@
usage 'sink thing_to_sink'
summary 'sinks stuff'
description 'Sinks stuff (like ships and the like).'
run do |opts, args|
- $stdout.puts "Sinking!"
end
end
super_cmd
end
@@ -436,10 +435,20 @@
cmd.run(%w( foo -- bar ))
end
assert_equal "args=foo,bar args.raw=foo,--,bar\n", out
end
+ def test_run_without_block
+ cmd = Cri::Command.define do
+ name 'moo'
+ end
+
+ assert_raises(Cri::NotImplementedError) do
+ cmd.run([])
+ end
+ end
+
def test_runner_with_raw_args
cmd = Cri::Command.define do
name 'moo'
runner(Class.new(Cri::CommandRunner) do
def run
@@ -450,8 +459,16 @@
out, err = capture_io_while do
cmd.run(%w( foo -- bar ))
end
assert_equal "args=foo,bar args.raw=foo,--,bar\n", out
+ end
+
+ def test_compare
+ foo = Cri::Command.define { name 'foo' }
+ bar = Cri::Command.define { name 'bar' }
+ qux = Cri::Command.define { name 'qux' }
+
+ assert_equal [ bar, foo, qux ], [ foo, bar, qux ].sort
end
end