summaryrefslogtreecommitdiffstats
path: root/test/language/ast
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2007-11-28 15:20:52 -0600
committerLuke Kanies <luke@madstop.com>2007-11-28 15:20:52 -0600
commit11ae473e3852adcc382a3efea2329586d2e4bcb3 (patch)
tree7a7ff70f7d9f7bc9af0635c56690fb9fc810b9f5 /test/language/ast
parent8127397e1efafc13975b79eabf7ce951c1e90114 (diff)
Theoretically, this patch is to fix #917 (which it does), but
there were enough problems fixing it that I decided something more drastic needed to be done. This uses the new Puppet::ResourceReference class to canonize what a resource reference looks like and how to retrieve resources via their references. Specifically, it guarantees that resource types are always capitalized, even when they include '::' in them. While many files are modified in this commit, the majority of changes are quite small, and most of the changes are fixing the tests to use capitalized types. As we look at consolidating some of our resource types, we could consolidate the ResourceReference stuff at the same time, but at least the Puppet::Parser::ResourceReference class subclasses the main Puppet::ResourceReference class.
Diffstat (limited to 'test/language/ast')
-rwxr-xr-xtest/language/ast/definition.rb4
-rwxr-xr-xtest/language/ast/resource.rb8
-rwxr-xr-xtest/language/ast/resource_reference.rb12
3 files changed, 12 insertions, 12 deletions
diff --git a/test/language/ast/definition.rb b/test/language/ast/definition.rb
index b4d58a289..2a71aaa45 100755
--- a/test/language/ast/definition.rb
+++ b/test/language/ast/definition.rb
@@ -69,7 +69,7 @@ class TestASTDefinition < Test::Unit::TestCase
firstobj = config.findresource("File[/tmp/first]")
assert(firstobj, "Did not create /tmp/first obj")
- assert_equal("file", firstobj.type)
+ assert_equal("File", firstobj.type)
assert_equal("/tmp/first", firstobj.title)
assert_equal("nobody", firstobj[:owner])
assert_equal("755", firstobj[:mode])
@@ -99,7 +99,7 @@ class TestASTDefinition < Test::Unit::TestCase
secondobj = config.findresource("File[/tmp/second]")
assert(secondobj, "Did not create /tmp/second obj")
- assert_equal("file", secondobj.type)
+ assert_equal("File", secondobj.type)
assert_equal("/tmp/second", secondobj.title)
assert_equal("daemon", secondobj[:owner])
assert_equal("755", secondobj[:mode])
diff --git a/test/language/ast/resource.rb b/test/language/ast/resource.rb
index 49c64112d..c99d98eeb 100755
--- a/test/language/ast/resource.rb
+++ b/test/language/ast/resource.rb
@@ -36,19 +36,19 @@ class TestASTResource< Test::Unit::TestCase
title = "title"
# First try a qualified type
- assert_equal("one::two", newdef("two", title).evaluate(:scope => twoscope)[0].type,
+ assert_equal("One::Two", newdef("two", title).evaluate(:scope => twoscope)[0].type,
"Defined type was not made fully qualified")
# Then try a type that does not need to be qualified
- assert_equal("one", newdef("one", title).evaluate(:scope => twoscope)[0].type,
+ assert_equal("One", newdef("one", title).evaluate(:scope => twoscope)[0].type,
"Unqualified defined type was not handled correctly")
# Then an unqualified type from within the one namespace
- assert_equal("three", newdef("three", title).evaluate(:scope => twoscope)[0].type,
+ assert_equal("Three", newdef("three", title).evaluate(:scope => twoscope)[0].type,
"Defined type was not made fully qualified")
# Then a builtin type
- assert_equal("file", newdef("file", title).evaluate(:scope => twoscope)[0].type,
+ assert_equal("File", newdef("file", title).evaluate(:scope => twoscope)[0].type,
"Builtin type was not handled correctly")
# Now try a type that does not exist, which should throw an error.
diff --git a/test/language/ast/resource_reference.rb b/test/language/ast/resource_reference.rb
index 5a18d3f45..c9fde078f 100755
--- a/test/language/ast/resource_reference.rb
+++ b/test/language/ast/resource_reference.rb
@@ -26,7 +26,7 @@ class TestASTResourceReference < Test::Unit::TestCase
def test_evaluate
@parser.newdefine "one::two"
@parser.newdefine "one-two"
- [%w{file /tmp/yay}, %w{one::two three}, %w{one-two three}].each do |type, title|
+ [%w{File /tmp/yay}, %w{One::Two three}, %w{One-two three}].each do |type, title|
ref = newref(type, title)
evaled = nil
@@ -47,7 +47,7 @@ class TestASTResourceReference < Test::Unit::TestCase
evaled = ref.evaluate(:scope => @scope)
end
- assert_equal("class", evaled.type, "Did not set type to 'class'")
+ assert_equal("Class", evaled.type, "Did not set type to 'class'")
assert_equal("one", evaled.title, "Did not look up class corectly")
end
@@ -61,19 +61,19 @@ class TestASTResourceReference < Test::Unit::TestCase
title = "title"
# First try a qualified type
- assert_equal("one::two", newref("two", title).evaluate(:scope => twoscope).type,
+ assert_equal("One::Two", newref("two", title).evaluate(:scope => twoscope).type,
"Defined type was not made fully qualified")
# Then try a type that does not need to be qualified
- assert_equal("one", newref("one", title).evaluate(:scope => twoscope).type,
+ assert_equal("One", newref("one", title).evaluate(:scope => twoscope).type,
"Unqualified defined type was not handled correctly")
# Then an unqualified type from within the one namespace
- assert_equal("three", newref("three", title).evaluate(:scope => twoscope).type,
+ assert_equal("Three", newref("three", title).evaluate(:scope => twoscope).type,
"Defined type was not made fully qualified")
# Then a builtin type
- assert_equal("file", newref("file", title).evaluate(:scope => twoscope).type,
+ assert_equal("File", newref("file", title).evaluate(:scope => twoscope).type,
"Builtin type was not handled correctly")
# Now try a type that does not exist, which should throw an error.