3 require 'treetop/compiler'
4 Treetop.load(File.join(TORSPEC_ROOT, 'lib/torspec/primitives'))
6 describe "PrimitivesGrammar" do
7 it "should parse a valid DateTime value" do
8 text = "2011-04-01 22:10:01"
9 parser = Torspec::PrimitivesParser.new
10 nodes = parser.parse(text, :root => :DateTime)
11 nodes.should_not be_nil
14 it "should not parse a invalid DateTime value" do
15 text = "2011-04-01 25r:10:01"
16 parser = Torspec::PrimitivesParser.new
17 nodes = parser.parse(text, :root => :DateTime)