Sha256: bd5180c3ebe3a72406b13f2debf0a06e0e1dc292f97618aec7c4a61dd2fd67b5
Contents?: true
Size: 1.17 KB
Versions: 6
Compression:
Stored size: 1.17 KB
Contents
require File.join(File.dirname(__FILE__), '..', 'test_helper') class TerminalSymbolTest < CompilerTestCase class Foo < Treetop::Runtime::SyntaxNode end testing_expression "'foo' <Foo> { def a_method; end }" it "correctly parses matching input prefixes at various indices, returning an instance of the declared class that can respond to methods defined in the inline module" do parse "foo", :at_index => 0 do |result| result.should be_an_instance_of(Foo) result.should respond_to(:a_method) result.interval.should == (0...3) result.text_value.should == 'foo' end parse "xfoo", :at_index => 1 do |result| result.should be_an_instance_of(Foo) result.should respond_to(:a_method) result.interval.should == (1...4) result.text_value.should == 'foo' end parse "---foo", :at_index => 3 do |result| result.should be_an_instance_of(Foo) result.should respond_to(:a_method) result.interval.should == (3...6) result.text_value.should == 'foo' end end it "fails to parse nonmatching input at the index even if a match occurs later" do parse(" foo", :at_index => 0).should be_failure end end
Version data entries
6 entries across 6 versions & 1 rubygems