diff options
| author | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-04-11 17:48:14 +0000 |
|---|---|---|
| committer | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-04-11 17:48:14 +0000 |
| commit | 373fb3b57c9edafc1935789d7b5cb99d45656f2e (patch) | |
| tree | cebfba070aafef332bb0ea49b758cbeed5cb41d9 /test/language | |
| parent | 8df349c61314d5bf0acc0402f90bb5399014d442 (diff) | |
| download | puppet-373fb3b57c9edafc1935789d7b5cb99d45656f2e.tar.gz puppet-373fb3b57c9edafc1935789d7b5cb99d45656f2e.tar.xz puppet-373fb3b57c9edafc1935789d7b5cb99d45656f2e.zip | |
Modifying "setclass" on scope to check the validity of class names, now that "set" can be used to set them manually, and added a test for it.
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1104 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'test/language')
| -rwxr-xr-x | test/language/scope.rb | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/test/language/scope.rb b/test/language/scope.rb index 06d244543..48689cd2e 100755 --- a/test/language/scope.rb +++ b/test/language/scope.rb @@ -546,4 +546,21 @@ class TestScope < Test::Unit::TestCase assert_equal("root", obj["owner"], "Owner did not take") assert_equal("755", obj["mode"], "Mode did not take") end + + def test_validclassnames + scope = Puppet::Parser::Scope.new() + + ["a-class", "a class", "Class", "a.class"].each do |bad| + assert_raise(Puppet::ParseError, "Incorrectly allowed %s" % bad.inspect) do + scope.setclass(object_id, bad) + end + end + + ["a_class", "class", "yayNess"].each do |good| + assert_nothing_raised("Incorrectly banned %s" % good.inspect) do + scope.setclass(object_id, good) + end + end + + end end |
