Skip to content

Instantly share code, notes, and snippets.

@aslakhellesoy
Created December 13, 2008 12:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save aslakhellesoy/35458 to your computer and use it in GitHub Desktop.
Save aslakhellesoy/35458 to your computer and use it in GitHub Desktop.
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
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