Sha256: bdd83f9f7c15580010e78fc7f767c1b12a3b9672f023be6cf6b8aec3370e3947
Contents?: true
Size: 1.31 KB
Versions: 8
Compression:
Stored size: 1.31 KB
Contents
require File.expand_path('../test_helper.rb', File.dirname(__FILE__)) describe "Handling errors" do describe "RipperRubyParser::Parser#parse" do let :newparser do RipperRubyParser::Parser.new end it "raises an error for an incomplete source" do proc { newparser.parse "def foo" }.must_raise RipperRubyParser::SyntaxError end it "raises an error for an invalid class name" do proc { newparser.parse("class foo; end") }.must_raise RipperRubyParser::SyntaxError end it "raises an error aliasing $1 as foo" do proc { newparser.parse "alias foo $1" }.must_raise RipperRubyParser::SyntaxError end it "raises an error aliasing foo as $1" do proc { newparser.parse "alias $1 foo" }.must_raise RipperRubyParser::SyntaxError end it "raises an error aliasing $2 as $1" do proc { newparser.parse "alias $1 $2" }.must_raise RipperRubyParser::SyntaxError end it "raises an error assigning to $1" do proc { newparser.parse "$1 = foo" }.must_raise RipperRubyParser::SyntaxError end it "raises an error using an invalid parameter name" do proc { newparser.parse "def foo(BAR); end" }.must_raise RipperRubyParser::SyntaxError end end end
Version data entries
8 entries across 8 versions & 1 rubygems