diff options
author | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2019-01-15 08:55:56 +0000 |
---|---|---|
committer | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2019-01-15 08:55:56 +0000 |
commit | 402906e265bf5eeb94d6de5db2246ca15c4746a7 (patch) | |
tree | 55b1c501769fc69c14b56fc21a7467805526a59d | |
parent | da7dedecae53231a949e31af0b4d319b298e6ddf (diff) |
merge revision(s) 66736: [Backport #15511]
ast.c: argument must be a string
[ruby-core:90904] [Bug #15511]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_6@66827 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ast.c | 2 | ||||
-rw-r--r-- | test/ruby/test_ast.rb | 8 | ||||
-rw-r--r-- | version.h | 2 |
3 files changed, 10 insertions, 2 deletions
@@ -96,7 +96,7 @@ rb_ast_parse_str(VALUE str) { rb_ast_t *ast = 0; - str = rb_check_string_type(str); + StringValue(str); ast = rb_parser_compile_string_path(ast_parse_new(), Qnil, str, 1); return ast_parse_done(ast); } diff --git a/test/ruby/test_ast.rb b/test/ruby/test_ast.rb index 055567d574..23cd5618a0 100644 --- a/test/ruby/test_ast.rb +++ b/test/ruby/test_ast.rb @@ -134,6 +134,14 @@ class TestAst < Test::Unit::TestCase assert_raise(TypeError) {RubyVM::AbstractSyntaxTree::Node.allocate} end + def test_parse_argument_error + assert_raise(TypeError) {RubyVM::AbstractSyntaxTree.parse(0)} + assert_raise(TypeError) {RubyVM::AbstractSyntaxTree.parse(nil)} + assert_raise(TypeError) {RubyVM::AbstractSyntaxTree.parse(false)} + assert_raise(TypeError) {RubyVM::AbstractSyntaxTree.parse(true)} + assert_raise(TypeError) {RubyVM::AbstractSyntaxTree.parse(:foo)} + end + def test_column_with_long_heredoc_identifier term = "A"*257 ast = RubyVM::AbstractSyntaxTree.parse("<<-#{term}\n""ddddddd\n#{term}\n") @@ -1,6 +1,6 @@ #define RUBY_VERSION "2.6.0" #define RUBY_RELEASE_DATE RUBY_RELEASE_YEAR_STR"-"RUBY_RELEASE_MONTH_STR"-"RUBY_RELEASE_DAY_STR -#define RUBY_PATCHLEVEL 11 +#define RUBY_PATCHLEVEL 12 #define RUBY_RELEASE_YEAR 2019 #define RUBY_RELEASE_MONTH 1 |