# frozen_string_literal: truerequire'psych'require'test/unit'classTestPyschRegexpDumpLoad < Test::Unit::TestCasedeftest_psych_versionassert'3.1.0',Psych::VERSIONenddeftest_dump_load_regexp_no_escapeassert_equal"--- !ruby/regexp /^[0-9]+/\n",Psych.dump(/^[0-9]+/)assert_equal/^[0-9]+/,Psych.load(Psych.dump(/^[0-9]+/))enddeftest_dump_load_regexp_with_slashassert_equal"--- !ruby/regexp /^\\//\n",Psych.dump(/^\//)assert_equal/^\//,Psych.load(Psych.dump(/^\//))endend
Loaded suite psych_regexp
Started
.F
=====================================================================================================================================================================================
15:
16: def test_dump_load_regexp_with_slash
17: assert_equal "--- !ruby/regexp /^\\//\n", Psych.dump(/^\//)
=> 18: assert_equal /^\//, Psych.load(Psych.dump(/^\//))
19: end
20: end
psych_regexp.rb:18:in `test_dump_load_regexp_with_slash'
</^\//> expected but was
</^\//>
diff:
/^\//
Failure: test_dump_load_regexp_with_slash(TestPyschRegexpDumpLoad)
=====================================================================================================================================================================================
.
Finished in 0.006877 seconds.
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
3 tests, 5 assertions, 1 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications
66.6667% passed
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
436.24 tests/s, 727.06 assertions/s
Problem
$ irb -r psychSTR
Run
Actual Result
Expected Result
Test passed