summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rwxr-xr-xtest/certmgr/support.rb6
-rw-r--r--test/data/snippets/multilinecomments.pp6
-rw-r--r--test/data/snippets/multipleclass.pp9
-rwxr-xr-xtest/language/snippets.rb16
4 files changed, 31 insertions, 6 deletions
diff --git a/test/certmgr/support.rb b/test/certmgr/support.rb
index 10d431939..d418c6771 100755
--- a/test/certmgr/support.rb
+++ b/test/certmgr/support.rb
@@ -86,17 +86,11 @@ class TestCertSupport < Test::Unit::TestCase
# Write a key out to disk in a file containing upper-case.
key = OpenSSL::PKey::RSA.new(32)
should_path = Puppet[:hostprivkey]
- puts "%s: %s" % [should_path, FileTest.exist?(should_path).inspect]
dir, file = File.split(should_path)
newfile = file.sub(/^([a-z.]+)\./) { $1.upcase + "."}
- puts "%s: %s" % [should_path, FileTest.exist?(should_path).inspect]
upper_path = File.join(dir, newfile)
- puts "%s: %s" % [should_path, FileTest.exist?(should_path).inspect]
- puts "%s: %s" % [upper_path, FileTest.exist?(upper_path).inspect]
File.open(upper_path, "w") { |f| f.print key.to_s }
- puts "%s: %s" % [should_path, FileTest.exist?(should_path).inspect]
- puts "%s: %s" % [upper_path, FileTest.exist?(upper_path).inspect]
user = CertUser.new
diff --git a/test/data/snippets/multilinecomments.pp b/test/data/snippets/multilinecomments.pp
new file mode 100644
index 000000000..816baebd7
--- /dev/null
+++ b/test/data/snippets/multilinecomments.pp
@@ -0,0 +1,6 @@
+
+/*
+file {
+ "/tmp/multilinecomments": content => "pouet"
+}
+*/
diff --git a/test/data/snippets/multipleclass.pp b/test/data/snippets/multipleclass.pp
new file mode 100644
index 000000000..ae02edc38
--- /dev/null
+++ b/test/data/snippets/multipleclass.pp
@@ -0,0 +1,9 @@
+class one {
+ file { "/tmp/multipleclassone": content => "one" }
+}
+
+class one {
+ file { "/tmp/multipleclasstwo": content => "two" }
+}
+
+include one
diff --git a/test/language/snippets.rb b/test/language/snippets.rb
index 069f7aced..2a997c877 100755
--- a/test/language/snippets.rb
+++ b/test/language/snippets.rb
@@ -30,6 +30,13 @@ class TestSnippets < Test::Unit::TestCase
end
end
+ def assert_not_file(path, msg = nil)
+ if file = @file[path]
+ msg ||= "File %s exists!" % path
+ raise msg
+ end
+ end
+
def assert_mode_equal(mode, path)
unless file = @catalog.resource(:file, path)
raise "Could not find file %s" % path
@@ -459,6 +466,15 @@ class TestSnippets < Test::Unit::TestCase
"Did not make second file from array")
end
+ def snippet_multipleclass
+ assert_file("/tmp/multipleclassone", "one")
+ assert_file("/tmp/multipleclasstwo", "two")
+ end
+
+ def snippet_multilinecomments
+ assert_not_file("/tmp/multilinecomments","Did create a commented resource");
+ end
+
# Iterate across each of the snippets and create a test.
Dir.entries(snippetdir).sort.each { |file|
next if file =~ /^\./