Sha256: cb7ad439535f07c93a992d3debec470acdc29c70463a4f7610b566f87eba9ce7
Contents?: true
Size: 1.32 KB
Versions: 6
Compression:
Stored size: 1.32 KB
Contents
require File.join(File.dirname(__FILE__), '..', 'test_helper') class CharacterClassTest < CompilerTestCase class Foo < Treetop::Runtime::SyntaxNode end testing_expression "[A-Z] <Foo> { def a_method; end }" it "matches single characters within that range, returning instances of the declared node class that respond to the method defined in the inline module" do result = parse('A') result.should be_an_instance_of(Foo) result.should respond_to(:a_method) result = parse('N') result.should be_an_instance_of(Foo) result.should respond_to(:a_method) result = parse('Z') result.should be_an_instance_of(Foo) result.should respond_to(:a_method) end it "does not match single characters outside of that range" do parse('8').should be_failure parse('a').should be_failure end it "matches a single character within that range at index 1" do parse(' A', :at_index => 1).should be_success end it "fails to match a single character out of that range at index 1" do parse(' 1', :at_index => 1).should be_failure end end describe "A character class containing quotes", :extend => CompilerTestCase do testing_expression "[\"']" it "matches a quote" do parse("'").should be_success end it "matches a double-quote" do parse('"').should be_success end end
Version data entries
6 entries across 6 versions & 1 rubygems