Created
December 13, 2008 12:37
-
-
Save aslakhellesoy/35458 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Cucumber | |
module Parser | |
grammar Table | |
rule record | |
cell_value / (cell_value separator record) | |
end | |
rule separator | |
'|' | |
end | |
rule cell_value | |
(!separator .)+ | |
end | |
end | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require File.dirname(__FILE__) + '/../../spec_helper' | |
require 'treetop' | |
require 'cucumber/parser/table' | |
module Cucumber | |
module Parser | |
describe Table do | |
before do | |
@parser = TableParser.new | |
end | |
def parse(text) | |
@parser.parse(text) || raise(@parser.failure_reason) | |
end | |
it "should parse a row with one cell" do | |
parse("hi") | |
end | |
it "should parse a row with two cells" do | |
parse("hello|there") | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment