зеркало из https://github.com/github/ruby.git
ast.c: argument must be a string
[ruby-core:90904] [Bug #15511] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66736 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
6629588aa5
Коммит
dd3ed41cd0
2
ast.c
2
ast.c
|
@ -96,7 +96,7 @@ rb_ast_parse_str(VALUE str)
|
||||||
{
|
{
|
||||||
rb_ast_t *ast = 0;
|
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);
|
ast = rb_parser_compile_string_path(ast_parse_new(), Qnil, str, 1);
|
||||||
return ast_parse_done(ast);
|
return ast_parse_done(ast);
|
||||||
}
|
}
|
||||||
|
|
|
@ -134,6 +134,14 @@ class TestAst < Test::Unit::TestCase
|
||||||
assert_raise(TypeError) {RubyVM::AbstractSyntaxTree::Node.allocate}
|
assert_raise(TypeError) {RubyVM::AbstractSyntaxTree::Node.allocate}
|
||||||
end
|
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
|
def test_column_with_long_heredoc_identifier
|
||||||
term = "A"*257
|
term = "A"*257
|
||||||
ast = RubyVM::AbstractSyntaxTree.parse("<<-#{term}\n""ddddddd\n#{term}\n")
|
ast = RubyVM::AbstractSyntaxTree.parse("<<-#{term}\n""ddddddd\n#{term}\n")
|
||||||
|
|
Загрузка…
Ссылка в новой задаче