bin
doc
examples
lib
python
src
t
bin
00-assert.rb
00-exit_nonzero.rb
00-exit_status.rb
00-exit_zero.rb
00-file_equal.rb
00-file_not_equal.rb
00-ignore_file.rb
00-import_file.rb
00-stderr_equal.rb
00-stderr_not_equal.rb
00-stdout_equal.rb
00-stdout_not_equal.rb
01-cmd.rb
01-misc.rb
01-simple.rb
CMDTEST_assert.rb
CMDTEST_cmd.rb
CMDTEST_exit_nonzero.rb
CMDTEST_exit_status.rb
CMDTEST_exit_zero.rb
CMDTEST_file_equal.rb
CMDTEST_file_not_equal.rb
CMDTEST_ignore_file.rb
CMDTEST_import_file.rb
CMDTEST_misc.rb
CMDTEST_simple.rb
CMDTEST_stdxxx_equal.rb
selftest_utils.rb
.hgignore
COPYING.txt
README.html
README.rst
Rakefile
file1.txt
file2.txt
run-regression.rb
setup.rb
52 lines
1.0 KiB
Ruby
52 lines
1.0 KiB
Ruby
|
|
require "selftest_utils"
|
|
|
|
class CMDTEST_file_not_equal < Cmdtest::Testcase
|
|
|
|
include SelftestUtils
|
|
|
|
#----------------------------------------
|
|
# 'file_not_equal' detects different file content
|
|
|
|
def test_file_not_equal_CORRECT
|
|
create_CMDTEST_foo [
|
|
"file_open('foo', 'w') {|f| f.puts 'hello' }",
|
|
"",
|
|
"cmd 'true.rb' do",
|
|
" file_not_equal 'foo', ['world']",
|
|
"end",
|
|
]
|
|
|
|
cmd_cmdtest do
|
|
stdout_equal [
|
|
"### true.rb",
|
|
]
|
|
end
|
|
end
|
|
|
|
#-----------------------------------
|
|
# 'file_not_equal' detects equal file content
|
|
# and reports an error
|
|
|
|
def test_file_not_equal_INCORRECT
|
|
create_CMDTEST_foo [
|
|
"file_open('foo', 'w') {|f| f.puts 'hello' }",
|
|
"",
|
|
"cmd 'true.rb' do",
|
|
" file_not_equal 'foo', ['hello']",
|
|
"end",
|
|
]
|
|
|
|
cmd_cmdtest do
|
|
stdout_equal [
|
|
"### true.rb",
|
|
"--- ERROR: wrong file 'foo'",
|
|
"--- actual: hello",
|
|
"--- expect: hello",
|
|
]
|
|
exit_nonzero
|
|
end
|
|
end
|
|
|
|
end
|