add test of --no-diff option

This commit is contained in:
Johan Holmberg 2016-11-04 22:49:36 +01:00
parent 3c83c52c70
commit 1ed22c3163
2 changed files with 44 additions and 0 deletions

View File

@ -211,6 +211,41 @@ class CMDTEST_stdxxx_equal < Cmdtest::Testcase
end
end
#----------------------------------------
## methods: test_stdout_equal_DIFF test_stderr_equal_DIFF
define_method("test_#{stdxxx}_equal_NO_DIFF") do
create_CMDTEST_foo [
"cmd 'echo_#{stdxxx}.rb --lines 11 33 44 55-changed 66 77 88' do",
" #{stdxxx}_equal [ '11', '22', '33', '44', '55', '66', '77' ]",
"end",
]
cmd_cmdtest_no_diff do
stdout_equal [
"### echo_#{stdxxx}.rb --lines 11 33 44 55-changed 66 77 88",
"--- ERROR: wrong #{stdxxx}",
"--- actual: 11",
"--- 33",
"--- 44",
"--- 55-changed",
"--- 66",
"--- 77",
"--- 88",
"--- expect: 11",
"--- 22",
"--- 33",
"--- 44",
"--- 55",
"--- 66",
"--- 77",
]
exit_nonzero
end
end
#----------------------------------------
# stdxxx_not_equal
#----------------------------------------

View File

@ -59,6 +59,15 @@ module SelftestUtils
end
end
def cmd_cmdtest_no_diff(*args)
cmdtest = "#{TOP}/bin/cmdtest.rb"
command = "ruby %s --quiet --no-diff" % _quote(cmdtest)
cmd(command, *args) do
comment "running local cmdtest --no-diff"
yield
end
end
def cmd_cmdtest_verbose(*args)
cmdtest = "#{TOP}/bin/cmdtest.rb"
command = "ruby %s %s" % [