From 373fb3b57c9edafc1935789d7b5cb99d45656f2e Mon Sep 17 00:00:00 2001 From: luke Date: Tue, 11 Apr 2006 17:48:14 +0000 Subject: 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 --- test/language/scope.rb | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'test') 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 -- cgit