summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2008-09-27 21:30:49 +0200
committerLuke Kanies <luke@madstop.com>2008-09-27 21:30:49 +0200
commitb96bdc6a63f7be6b724c2aa7ad0ea007cba81718 (patch)
tree6d334ea12e1468b34160fa36da29dd7d78ac31ea /test
parente20f02af4a93478c5b08b7681caa12cd72b4a3a6 (diff)
parent3749267093923692d6e7bc0c9ce83b43a487b19e (diff)
Merge branch '0.24.x' of git://github.com/jamtur01/puppet into 0.24.x
Diffstat (limited to 'test')
-rw-r--r--test/data/snippets/append.pp11
-rwxr-xr-xtest/language/functions.rb10
-rwxr-xr-xtest/language/parser.rb8
3 files changed, 29 insertions, 0 deletions
diff --git a/test/data/snippets/append.pp b/test/data/snippets/append.pp
new file mode 100644
index 000000000..28edeb177
--- /dev/null
+++ b/test/data/snippets/append.pp
@@ -0,0 +1,11 @@
+$var=['/tmp/file1','/tmp/file2']
+
+class arraytest {
+ $var += ['/tmp/file3', '/tmp/file4']
+ file {
+ $var:
+ content => "test"
+ }
+}
+
+include arraytest
diff --git a/test/language/functions.rb b/test/language/functions.rb
index 97429802b..50a61a148 100755
--- a/test/language/functions.rb
+++ b/test/language/functions.rb
@@ -379,6 +379,8 @@ class TestLangFunctions < Test::Unit::TestCase
scope = mkscope
parser = scope.compiler.parser
+ realize = Puppet::Parser::Functions.function(:realize)
+
# Make a definition
parser.newdefine("mytype")
@@ -434,6 +436,8 @@ class TestLangFunctions < Test::Unit::TestCase
def test_defined
scope = mkscope
parser = scope.compiler.parser
+
+ defined = Puppet::Parser::Functions.function(:defined)
parser.newclass("yayness")
parser.newdefine("rahness")
@@ -491,6 +495,8 @@ class TestLangFunctions < Test::Unit::TestCase
scope = mkscope
parser = scope.compiler.parser
+ include = Puppet::Parser::Functions.function(:include)
+
assert_raise(Puppet::ParseError, "did not throw error on missing class") do
scope.function_include("nosuchclass")
end
@@ -508,6 +514,8 @@ class TestLangFunctions < Test::Unit::TestCase
parser = mkparser
scope = mkscope(:parser => parser)
+ file = Puppet::Parser::Functions.function(:file)
+
file1 = tempfile
file2 = tempfile
file3 = tempfile
@@ -548,6 +556,8 @@ class TestLangFunctions < Test::Unit::TestCase
assert_equal("yay\n", %x{#{command}}, "command did not work")
assert_equal("yay-foo\n", %x{#{command} foo}, "command did not work")
+ generate = Puppet::Parser::Functions.function(:generate)
+
scope = mkscope
parser = scope.compiler.parser
diff --git a/test/language/parser.rb b/test/language/parser.rb
index cdd13297a..fc8452b87 100755
--- a/test/language/parser.rb
+++ b/test/language/parser.rb
@@ -1208,5 +1208,13 @@ file { "/tmp/yayness":
parser.import("test")
end
end
+
+ def test_watch_file_only_once
+ FileTest.stubs(:exists?).returns(true)
+ parser = mkparser
+ parser.watch_file("doh")
+ parser.watch_file("doh")
+ assert_equal(1, parser.files.select { |name, file| file.file == "doh" }.length, "Length of watched 'doh' files was not 1")
+ end
end