diff options
Diffstat (limited to 'spec/unit/pops/parser/parser_spec.rb')
-rw-r--r-- | spec/unit/pops/parser/parser_spec.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/spec/unit/pops/parser/parser_spec.rb b/spec/unit/pops/parser/parser_spec.rb index fb44a08c9..23f537eeb 100644 --- a/spec/unit/pops/parser/parser_spec.rb +++ b/spec/unit/pops/parser/parser_spec.rb @@ -14,4 +14,20 @@ describe Puppet::Pops::Parser::Parser do model.body.class.should == Puppet::Pops::Model::AssignmentExpression end + it "should accept empty input and return a model" do + parser = Puppet::Pops::Parser::Parser.new() + model = parser.parse_string("").current + model.class.should == Puppet::Pops::Model::Program + model.body.class.should == Puppet::Pops::Model::Nop + end + + it "should accept empty input containing only comments and report location at end of input" do + parser = Puppet::Pops::Parser::Parser.new() + model = parser.parse_string("# comment\n").current + model.class.should == Puppet::Pops::Model::Program + model.body.class.should == Puppet::Pops::Model::Nop + adapter = Puppet::Pops::Adapters::SourcePosAdapter.adapt(model.body) + expect(adapter.offset).to eq(10) + expect(adapter.length).to eq(0) + end end |