Skip to content

Instantly share code, notes, and snippets.

@josephwilk
Forked from aslakhellesoy/table.tt
Created December 13, 2008 12:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save josephwilk/35463 to your computer and use it in GitHub Desktop.
Save josephwilk/35463 to your computer and use it in GitHub Desktop.
module Cucumber
module Parser
grammar Table
rule record
(cell_value separator record) / cell_value
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