Sha256: 426a8eb7bb924b20713d9c40a8dde57684d3c4adf614e6eb755b12c85d91e876
Contents?: true
Size: 1.52 KB
Versions: 20
Compression:
Stored size: 1.52 KB
Contents
require 'spec_helper' require 'puppet/pops' require_relative 'parser_rspec_helper' describe "egrammar parsing of site expression" do include ParserRspecHelper context "when parsing 'site'" do it "raises a syntax error" do expect { parse("site { }") }.to raise_error(Puppet::ParseErrorWithIssue, /Syntax error at 'site' \(line: 1, column: 1\)/) end end context 'When parsing collections containing application management specific keywords' do %w(application site produces consumes).each do |keyword| it "disallows the keyword '#{keyword}' in a list" do expect { parse("$a = [#{keyword}]") }.to raise_error(Puppet::ParseErrorWithIssue, /Syntax error at '#{keyword}' \(line: 1, column: 7\)/) end it "disallows the keyword '#{keyword}' as a key in a hash" do expect { parse("$a = {#{keyword}=>'x'}") }.to raise_error(Puppet::ParseErrorWithIssue, /Syntax error at '#{keyword}' \(line: 1, column: 7\)/) end it "disallows the keyword '#{keyword}' as a value in a hash" do expect { parse("$a = {'x'=>#{keyword}}") }.to raise_error(Puppet::ParseErrorWithIssue, /Syntax error at '#{keyword}' \(line: 1, column: 12\)/) end it "disallows the keyword '#{keyword}' as an attribute name" do expect { parse("foo { 'x': #{keyword} => 'value' } ") }.to raise_error(Puppet::ParseErrorWithIssue, /Syntax error at '#{keyword}' \(line: 1, column: 12\)/) end end end end
Version data entries
20 entries across 20 versions & 1 rubygems