Skip to content

(Maint) Fix mis-use of rvalue functions as statements #91

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 20, 2012
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .rspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
--color
--format
progress
--backtrace
4 changes: 2 additions & 2 deletions spec/unit/puppet/parser/functions/getvar_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ def get_scope
describe 'when calling getvar from puppet' do

it "should not compile when no arguments are passed" do
Puppet[:code] = 'getvar()'
Puppet[:code] = '$rval = getvar()'
get_scope
expect { @scope.compiler.compile }.should raise_error(Puppet::ParseError, /wrong number of arguments/)
end
it "should not compile when too many arguments are passed" do
Puppet[:code] = 'getvar("foo::bar", "baz")'
Puppet[:code] = '$rval = getvar("foo::bar", "baz")'
get_scope
expect { @scope.compiler.compile }.should raise_error(Puppet::ParseError, /wrong number of arguments/)
end
Expand Down
6 changes: 3 additions & 3 deletions spec/unit/puppet/parser/functions/has_key_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@

describe 'when calling has_key from puppet' do
it "should not compile when no arguments are passed" do
Puppet[:code] = 'has_key()'
Puppet[:code] = '$rval = has_key()'
expect { compiler.compile }.should raise_error(Puppet::ParseError, /wrong number of arguments/)
end
it "should not compile when 1 argument is passed" do
Puppet[:code] = "has_key('foo')"
Puppet[:code] = "$rval = has_key('foo')"
expect { compiler.compile }.should raise_error(Puppet::ParseError, /wrong number of arguments/)
end
it "should require the first value to be a Hash" do
Puppet[:code] = "has_key('foo', 'bar')"
Puppet[:code] = "$rval = has_key('foo', 'bar')"
expect { compiler.compile }.should raise_error(Puppet::ParseError, /expects the first argument to be a hash/)
end
end
Expand Down
4 changes: 2 additions & 2 deletions spec/unit/puppet/parser/functions/merge_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@

describe 'when calling merge from puppet' do
it "should not compile when no arguments are passed" do
Puppet[:code] = 'merge()'
Puppet[:code] = '$rval = merge()'
expect { compiler.compile }.should raise_error(Puppet::ParseError, /wrong number of arguments/)
end
it "should not compile when 1 argument is passed" do
Puppet[:code] = "$my_hash={'one' => 1}\nmerge($my_hash)"
Puppet[:code] = "$my_hash={'one' => 1}\n$rval = merge($my_hash)"
expect { compiler.compile }.should raise_error(Puppet::ParseError, /wrong number of arguments/)
end
end
Expand Down