Sha256: 3ba64368641cb4380e4dc05fdbe8e5b70fcbdd2fc85ec8e1cf8558b09de9808f
Contents?: true
Size: 1.07 KB
Versions: 1
Compression:
Stored size: 1.07 KB
Contents
require 'spec_helper' module Sexpr::Parser describe Citrus, "parse" do let(:parser){ Citrus.new(bool_expr_parser) } it 'delegates the call to the Citrus parser' do parser.parse("true").should be_a(::Citrus::Match) end it 'raises a Citrus::ParserError when parsing fails' do lambda{ parser.parse("bl and or") }.should raise_error(::Citrus::ParseError) end it 'recognizes the :root option' do parser.parse("true", :root => :bool_lit).should be_a(::Citrus::Match) parser.parse("x", :root => :var_ref).should be_a(::Citrus::Match) lambda{ parser.parse("x", :root => :bool_lit) }.should raise_error(::Citrus::ParseError) end it 'recognizes the :consume option' do lambda{ parser.parse("true or") }.should raise_error(::Citrus::ParseError) parser.parse("true or", :consume => false).should eq("true") end it 'can parse from a Path' do Path.tmpfile do |tmp| tmp.write "x and y" parser.parse(tmp).should be_a(::Citrus::Match) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
sexpr-0.3.0 | spec/parser/citrus/test_parse.rb |