[ruby/yarp] Fix test-unit API in fuzzer test

https://github.com/ruby/yarp/commit/d24f62566e
This commit is contained in:
Kevin Newton 2023-08-30 14:35:59 -04:00 committed by git
parent 2d009805e7
commit eac3da173a

View File

@ -2,27 +2,25 @@
require_relative "test_helper" require_relative "test_helper"
# These tests are simply to exercise snippets found by the fuzzer that caused invalid memory access. module YARP
class FuzzerTest < Test::Unit::TestCase # These tests are simply to exercise snippets found by the fuzzer that caused invalid memory access.
class << self class FuzzerTest < Test::Unit::TestCase
def snippet(name, source) def self.snippet(name, source)
test "fuzzer #{name}" do define_method(:"test_fuzzer_#{name}") { YARP.dump(source) }
YARP.dump(source)
end
end end
end
snippet "incomplete global variable", "$" snippet "incomplete global variable", "$"
snippet "incomplete symbol", ":" snippet "incomplete symbol", ":"
snippet "incomplete escaped string", '"\\' snippet "incomplete escaped string", '"\\'
snippet "trailing comment", "1\n#\n" snippet "trailing comment", "1\n#\n"
snippet "comment followed by whitespace at end of file", "1\n#\n " snippet "comment followed by whitespace at end of file", "1\n#\n "
snippet "trailing asterisk", "a *" snippet "trailing asterisk", "a *"
snippet "incomplete decimal number", "0d" snippet "incomplete decimal number", "0d"
snippet "incomplete binary number", "0b" snippet "incomplete binary number", "0b"
snippet "incomplete octal number", "0o" snippet "incomplete octal number", "0o"
snippet "incomplete hex number", "0x" snippet "incomplete hex number", "0x"
snippet "incomplete escaped list", "%w[\\" snippet "incomplete escaped list", "%w[\\"
snippet "incomplete escaped regex", "/a\\" snippet "incomplete escaped regex", "/a\\"
snippet "unterminated heredoc with unterminated escape at end of file", "<<A\n\\" snippet "unterminated heredoc with unterminated escape at end of file", "<<A\n\\"
end
end end