summaryrefslogtreecommitdiffstats
path: root/spec/integration/parser/compiler_spec.rb
Commit message (Collapse)AuthorAgeFilesLines
* (#8663) Exclude git rev-parse HEAD spec test on WindowsJosh Cooper2011-08-041-1/+2
| | | | | | | | | | | | | | | When running spec/integration/parser/compiler_spec.rb, the git command passed to Puppet::Util.execute is an array containing a single string ["git rev-parse HEAD"]. On Unix, it calls Kernel.exec(*command), but on Windows it calls Process.create(:command_line =>command), which attempts to execute the program called "git rev-parse HEAD" and fails: CreateProcess() failed: The system cannot find the file specified. This commit marks the test as fails_on_windows, and will be re-enabled when #8410 is fixed. Reviewed-by: Nick Lewis <nick@puppetlabs.com>
* maint: clean up the spec test headers in bulk.Daniel Pittman2011-04-131-2/+1
| | | | | | | We now use a shebang of: #!/usr/bin/env rspec This enables the direct execution of spec tests again, which was lost earlier during the transition to more directly using the rspec2 runtime environment.
* maint: just require 'spec_helper', thanks rspec2Daniel Pittman2011-04-081-1/+1
| | | | | | | | | | | rspec2 automatically sets a bunch of load-path stuff we were by hand, so we can just stop. As a side-effect we can now avoid a whole pile of stupid things to try and include the spec_helper.rb file... ...and then we can stop protecting spec_helper from evaluating twice, since we now require it with a consistent name. Yay. Reviewed-By: Pieter van de Bruggen <pieter@puppetlabs.com>
* maint: Use expand_path when requiring spec_helper or puppettestMatt Robinson2010-12-061-1/+1
| | | | | | | | | Doing a require to a relative path can cause files to be required more than once when they're required from different relative paths. If you expand the path fully, this won't happen. Ruby 1.9 also requires that you use expand_path when doing these requires. Paired-with: Jesse Wolfe
* Merge commit '2.6.2rc1' into nextJesse Wolfe2010-10-041-0/+21
|\
| * Fixes #4792 (Duplicate definition since 2.6.1 upgrade)Paul Berry2010-09-301-0/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The evaluate_definitions method was first figuring out which resources needed to be evaluated (using unevaluated_resources), and then evaluating them one by one. As a result, if evaluating one resource triggered another resource to be evaluated, the latter resource could get evaluated twice. This bug could occur, for example, if both resources were classes that were included into the node by an external node classifier, and if the first of the two classes included the second. Modified Resource#evaluate to be idempotent. Also added an integration test to verify the fix.
| * [#4397]+[#4344] Move type-name resolution out of Puppet::Resource into the ↵Jesse Wolfe2010-08-031-0/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | AST resources. Move type-name resolution out of Puppet::Resource into the AST resources. Move find_resource_type out of Puppet::Resource into Scope Thus, never pass unqualified type names to Puppet::Resource objects. Thus, Puppet::Resource objects don't need the namespace property, and Puppet::Resource objects never consult the harddrive to look for .pp files that might contain their type definitions, Thus, performance is improved. Also removes the temporary fix for #4257 that caused #4397 (The code was too eager to look for a class in the topscope) Paired-With: Paul Berry <paul@puppetlabs.com> Signed-off-by: Jesse Wolfe <jes5199@gmail.com>
* | Modified the error message that is generated when a class, definition,Paul Berry2010-09-071-7/+15
| | | | | | | | | | or node occurs in a conditional construct so that it contains the proper line number.
* | [#4685] Classes, defines, and nodes allowed inside of non-evaluated conditionalsPaul Berry2010-09-011-1/+12
| | | | | | | | | | | | | | | | | | | | | | Previously, ASTArray#evaluate() was responsible for checking whether the user had tried to declare a class, define, or node in a prohibited location (such as a conditional construct). This meant that errors would only be reported to the user if the conditional code was actually evaluated. Moved the checking into the parser, so that errors are always reported.
* | [#4496]+[#4521]+[#4522] Add structures to the AST to represent type ↵Paul Berry2010-08-131-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | definitions (classes, definitions, and nodes). Previously, type definitions were not represented directly in the AST. Instead, the parser would instantiate types and insert them into known_resource_types as soon as they were parsed. This made it difficult to distinguish which types had come from the file that was just parsed and which types had been loaded previously, which led to bug 4496. A side-effect of this change is that the user is no longer allowed to define types inside of conditional constructs (such as if/else). This was allowed before but had unexpected semantics (bugs 4521 and 4522). It is still possible, however, to place an "include" statement inside a conditional construct, and have that "include" statement trigger the autoloading of a file that instantiates types.
* | Moved perform_initial_import from Puppet::Resource::TypeCollection to ↵Paul Berry2010-08-131-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | Puppet::Node::Environment. This change is part of an ongoing effort to remove functionality from TypeCollection that is not related to keeping track of a collection of types. This reduces TypeCollection's linkage to the environment, which is a step toward decoupling it from the type loading mechanism. Also, added a spec test to verify that TypeCollection.version is correctly recomputed when types are re-imported.
* | [#4397]+[#4344] Move type-name resolution out of Puppet::Resource into the ↵Jesse Wolfe2010-07-301-0/+43
|/ | | | | | | | | | | | | | | | | | AST resources. Move type-name resolution out of Puppet::Resource into the AST resources. Move find_resource_type out of Puppet::Resource into Scope Thus, never pass unqualified type names to Puppet::Resource objects. Thus, Puppet::Resource objects don't need the namespace property, and Puppet::Resource objects never consult the harddrive to look for .pp files that might contain their type definitions, Thus, performance is improved. Also removes the temporary fix for #4257 that caused #4397 (The code was too eager to look for a class in the topscope) Paired-With: Paul Berry <paul@puppetlabs.com> Signed-off-by: Jesse Wolfe <jes5199@gmail.com>
* Code smell: Two space indentationMarkus Roberts2010-07-091-17/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Replaced 106806 occurances of ^( +)(.*$) with The ruby community almost universally (i.e. everyone but Luke, Markus, and the other eleven people who learned ruby in the 1900s) uses two-space indentation. 3 Examples: The code: end # Tell getopt which arguments are valid def test_get_getopt_args element = Setting.new :name => "foo", :desc => "anything", :settings => Puppet::Util::Settings.new assert_equal([["--foo", GetoptLong::REQUIRED_ARGUMENT]], element.getopt_args, "Did not produce appropriate getopt args") becomes: end # Tell getopt which arguments are valid def test_get_getopt_args element = Setting.new :name => "foo", :desc => "anything", :settings => Puppet::Util::Settings.new assert_equal([["--foo", GetoptLong::REQUIRED_ARGUMENT]], element.getopt_args, "Did not produce appropriate getopt args") The code: assert_equal(str, val) assert_instance_of(Float, result) end # Now test it with a passed object becomes: assert_equal(str, val) assert_instance_of(Float, result) end # Now test it with a passed object The code: end assert_nothing_raised do klass[:Yay] = "boo" klass["Cool"] = :yayness end becomes: end assert_nothing_raised do klass[:Yay] = "boo" klass["Cool"] = :yayness end
* [#3994-part 2] rename integration tests to *_spec.rbMarkus Roberts2010-06-281-0/+29
Some spec files like active_record.rb had names that would confuse the load path and get loaded instead of the intended implentation when the spec was run from the same directory as the file. Author: Matt Robinson <matt@puppetlabs.com> Date: Fri Jun 11 15:29:33 2010 -0700