From eac3da173acf801638656c57a4554773c3af5ac0 Mon Sep 17 00:00:00 2001 From: Kevin Newton Date: Wed, 30 Aug 2023 14:35:59 -0400 Subject: [PATCH] [ruby/yarp] Fix test-unit API in fuzzer test https://github.com/ruby/yarp/commit/d24f62566e --- test/yarp/fuzzer_test.rb | 40 +++++++++++++++++++--------------------- 1 file changed, 19 insertions(+), 21 deletions(-) diff --git a/test/yarp/fuzzer_test.rb b/test/yarp/fuzzer_test.rb index 8d818897a6..61845b91f7 100644 --- a/test/yarp/fuzzer_test.rb +++ b/test/yarp/fuzzer_test.rb @@ -2,27 +2,25 @@ require_relative "test_helper" -# These tests are simply to exercise snippets found by the fuzzer that caused invalid memory access. -class FuzzerTest < Test::Unit::TestCase - class << self - def snippet(name, source) - test "fuzzer #{name}" do - YARP.dump(source) - end +module YARP + # These tests are simply to exercise snippets found by the fuzzer that caused invalid memory access. + class FuzzerTest < Test::Unit::TestCase + def self.snippet(name, source) + define_method(:"test_fuzzer_#{name}") { YARP.dump(source) } end - end - snippet "incomplete global variable", "$" - snippet "incomplete symbol", ":" - snippet "incomplete escaped string", '"\\' - snippet "trailing comment", "1\n#\n" - snippet "comment followed by whitespace at end of file", "1\n#\n " - snippet "trailing asterisk", "a *" - snippet "incomplete decimal number", "0d" - snippet "incomplete binary number", "0b" - snippet "incomplete octal number", "0o" - snippet "incomplete hex number", "0x" - snippet "incomplete escaped list", "%w[\\" - snippet "incomplete escaped regex", "/a\\" - snippet "unterminated heredoc with unterminated escape at end of file", "<