class TestMinitestAssertionHelpers
Public Instance Methods
assert_mu_pp(exp, input, raw = false)
click to toggle source
# File minitest-5.13.0/test/minitest/test_minitest_assertions.rb, line 1247 def assert_mu_pp exp, input, raw = false act = mu_pp input if String === input && !raw then assert_equal "\"#{exp}\"", act else assert_equal exp, act end end
assert_mu_pp_for_diff(exp, input, raw = false)
click to toggle source
# File minitest-5.13.0/test/minitest/test_minitest_assertions.rb, line 1257 def assert_mu_pp_for_diff exp, input, raw = false act = mu_pp_for_diff input if String === input && !raw then assert_equal "\"#{exp}\"", act else assert_equal exp, act end end
test_diff_equal()
click to toggle source
# File minitest-5.13.0/test/minitest/test_minitest_assertions.rb, line 1267 def test_diff_equal msg = "No visible difference in the String#inspect output. You should look at the implementation of #== on String or its members. \"blahblahblahblahblahblahblahblahblahblah\"".gsub(/^ +/, "") o1 = "blah" * 10 o2 = "blah" * 10 def o1.== _ false end assert_equal msg, diff(o1, o2) end
test_diff_str_mixed()
click to toggle source
# File minitest-5.13.0/test/minitest/test_minitest_assertions.rb, line 1281 def test_diff_str_mixed msg = <<-'EOM'.gsub(/^ {10}/, "") # NOTE single quotes on heredoc --- expected +++ actual @@ -1 +1 @@ -"A\\n\nB" +"A\n\\nB" EOM exp = "A\\n\nB" act = "A\n\\nB" assert_equal msg, diff(exp, act) end
test_diff_str_multiline()
click to toggle source
# File minitest-5.13.0/test/minitest/test_minitest_assertions.rb, line 1296 def test_diff_str_multiline msg = <<-'EOM'.gsub(/^ {10}/, "") # NOTE single quotes on heredoc --- expected +++ actual @@ -1,2 +1,2 @@ "A -B" +C" EOM exp = "A\nB" act = "A\nC" assert_equal msg, diff(exp, act) end
test_diff_str_simple()
click to toggle source
# File minitest-5.13.0/test/minitest/test_minitest_assertions.rb, line 1312 def test_diff_str_simple msg = <<-'EOM'.gsub(/^ {10}/, "").chomp # NOTE single quotes on heredoc Expected: "A" Actual: "B" EOM exp = "A" act = "B" assert_equal msg, diff(exp, act) end
test_message()
click to toggle source
# File minitest-5.13.0/test/minitest/test_minitest_assertions.rb, line 1324 def test_message assert_equal "blah2.", message { "blah2" }.call assert_equal "blah2.", message("") { "blah2" }.call assert_equal "blah1.\nblah2.", message(:blah1) { "blah2" }.call assert_equal "blah1.\nblah2.", message("blah1") { "blah2" }.call message = proc { "blah1" } assert_equal "blah1.\nblah2.", message(message) { "blah2" }.call message = message { "blah1" } assert_equal "blah1.\nblah2.", message(message) { "blah2" }.call end
test_message_deferred()
click to toggle source
# File minitest-5.13.0/test/minitest/test_minitest_assertions.rb, line 1337 def test_message_deferred var = nil msg = message { var = "blah" } assert_nil var msg.call assert_equal "blah", var end
test_mu_pp()
click to toggle source
# File minitest-5.13.0/test/minitest/test_minitest_assertions.rb, line 1349 def test_mu_pp assert_mu_pp 42.inspect, 42 assert_mu_pp %w[a b c].inspect, %w[a b c] assert_mu_pp "A B", "A B" assert_mu_pp "A\\nB", "A\nB" assert_mu_pp "A\\\\nB", 'A\nB' # notice single quotes end
test_mu_pp_for_diff()
click to toggle source
# File minitest-5.13.0/test/minitest/test_minitest_assertions.rb, line 1357 def test_mu_pp_for_diff assert_mu_pp_for_diff "#<Object:0xXXXXXX>", Object.new assert_mu_pp_for_diff "A B", "A B" assert_mu_pp_for_diff [1, 2, 3].inspect, [1, 2, 3] assert_mu_pp_for_diff "A\nB", "A\nB" end
test_mu_pp_for_diff_str_bad_encoding()
click to toggle source
# File minitest-5.13.0/test/minitest/test_minitest_assertions.rb, line 1364 def test_mu_pp_for_diff_str_bad_encoding str = "\666".force_encoding Encoding::UTF_8 exp = "# encoding: UTF-8\n# valid: false\n\"\\xB6\"" assert_mu_pp_for_diff exp, str, :raw end
test_mu_pp_for_diff_str_bad_encoding_both()
click to toggle source
# File minitest-5.13.0/test/minitest/test_minitest_assertions.rb, line 1371 def test_mu_pp_for_diff_str_bad_encoding_both str = "\666A\\n\nB".force_encoding Encoding::UTF_8 exp = "# encoding: UTF-8\n# valid: false\n\"\\xB6A\\\\n\\nB\"" assert_mu_pp_for_diff exp, str, :raw end
test_mu_pp_for_diff_str_encoding()
click to toggle source
# File minitest-5.13.0/test/minitest/test_minitest_assertions.rb, line 1378 def test_mu_pp_for_diff_str_encoding str = "A\nB".b exp = "# encoding: ASCII-8BIT\n# valid: true\n\"A\nB\"" assert_mu_pp_for_diff exp, str, :raw end
test_mu_pp_for_diff_str_encoding_both()
click to toggle source
# File minitest-5.13.0/test/minitest/test_minitest_assertions.rb, line 1385 def test_mu_pp_for_diff_str_encoding_both str = "A\\n\nB".b exp = "# encoding: ASCII-8BIT\n# valid: true\n\"A\\\\n\\nB\"" assert_mu_pp_for_diff exp, str, :raw end
test_mu_pp_for_diff_str_nerd()
click to toggle source
# File minitest-5.13.0/test/minitest/test_minitest_assertions.rb, line 1392 def test_mu_pp_for_diff_str_nerd assert_mu_pp_for_diff "A\\nB\\\\nC", "A\nB\\nC" assert_mu_pp_for_diff "\\nB\\\\nC", "\nB\\nC" assert_mu_pp_for_diff "\\nB\\\\n", "\nB\\n" assert_mu_pp_for_diff "\\n\\\\n", "\n\\n" assert_mu_pp_for_diff "\\\\n\\n", "\\n\n" assert_mu_pp_for_diff "\\\\nB\\n", "\\nB\n" assert_mu_pp_for_diff "\\\\nB\\nC", "\\nB\nC" assert_mu_pp_for_diff "A\\\\n\\nB", "A\\n\nB" assert_mu_pp_for_diff "A\\n\\\\nB", "A\n\\nB" assert_mu_pp_for_diff "\\\\n\\n", "\\n\n" assert_mu_pp_for_diff "\\n\\\\n", "\n\\n" end
test_mu_pp_for_diff_str_normal()
click to toggle source
# File minitest-5.13.0/test/minitest/test_minitest_assertions.rb, line 1406 def test_mu_pp_for_diff_str_normal assert_mu_pp_for_diff "", "" assert_mu_pp_for_diff "A\\n\n", "A\\n" assert_mu_pp_for_diff "A\\n\nB", "A\\nB" assert_mu_pp_for_diff "A\n", "A\n" assert_mu_pp_for_diff "A\nB", "A\nB" assert_mu_pp_for_diff "\\n\n", "\\n" assert_mu_pp_for_diff "\n", "\n" assert_mu_pp_for_diff "\\n\nA", "\\nA" assert_mu_pp_for_diff "\nA", "\nA" end
test_mu_pp_str_bad_encoding()
click to toggle source
# File minitest-5.13.0/test/minitest/test_minitest_assertions.rb, line 1418 def test_mu_pp_str_bad_encoding str = "\666".force_encoding Encoding::UTF_8 exp = "# encoding: UTF-8\n# valid: false\n\"\\xB6\"" assert_mu_pp exp, str, :raw end
test_mu_pp_str_encoding()
click to toggle source
# File minitest-5.13.0/test/minitest/test_minitest_assertions.rb, line 1425 def test_mu_pp_str_encoding str = "A\nB".b exp = "# encoding: ASCII-8BIT\n# valid: true\n\"A\\nB\"" assert_mu_pp exp, str, :raw end
test_mu_pp_str_immutable()
click to toggle source
# File minitest-5.13.0/test/minitest/test_minitest_assertions.rb, line 1432 def test_mu_pp_str_immutable printer = Class.new { extend Minitest::Assertions } str = "test".freeze assert_equal '"test"', printer.mu_pp(str) end