diff options
| author | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-04-11 17:33:36 +0000 |
|---|---|---|
| committer | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-04-11 17:33:36 +0000 |
| commit | 8df349c61314d5bf0acc0402f90bb5399014d442 (patch) | |
| tree | d01c57482630bfb6372455bd1fa4d9d13269f09a /test | |
| parent | de0d1ddf13a8486ee6fe253e8c5a242aeca38c6a (diff) | |
Fixing the language side of #109. Added a "set" keyword.
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1103 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'test')
| -rwxr-xr-x | test/language/ast.rb | 31 | ||||
| -rwxr-xr-x | test/language/snippets.rb | 6 | ||||
| -rw-r--r-- | test/puppettest.rb | 25 |
3 files changed, 62 insertions, 0 deletions
diff --git a/test/language/ast.rb b/test/language/ast.rb index b2d620ac1..dc5934bc2 100755 --- a/test/language/ast.rb +++ b/test/language/ast.rb @@ -644,4 +644,35 @@ class TestAST < Test::Unit::TestCase objects = top.evaluate(:scope => scope) } end + + def test_setclass + type = "yay" + classes = [type] + children = [] + # Create child class one + children << varobj("variable", "aclass") + children << setobj(type, varref("variable")) + children << setobj(type) + + classes << "aclass" + + top = nil + assert_nothing_raised("Could not create top object") { + top = AST::ASTArray.new( + :children => children + ) + } + + scope = nil + assert_nothing_raised("Could not evaluate") { + scope = Puppet::Parser::Scope.new() + objects = top.evaluate(:scope => scope) + } + + + classes.each do |tag| + assert(scope.classlist.include?(tag), "Did not set class %s" % tag) + end + + end end diff --git a/test/language/snippets.rb b/test/language/snippets.rb index f10b12aaa..84ca4d73c 100755 --- a/test/language/snippets.rb +++ b/test/language/snippets.rb @@ -427,6 +427,12 @@ class TestSnippets < Test::Unit::TestCase } end + # There's no way to actually retrieve the list of classes from the + # transaction. + def snippet_set(trans) + @@tmpfiles << "/tmp/settestingness" + end + def snippet_emptyclass(trans) # There's nothing to check other than that it works end diff --git a/test/puppettest.rb b/test/puppettest.rb index 3959cf0fa..627ac6897 100644 --- a/test/puppettest.rb +++ b/test/puppettest.rb @@ -738,6 +738,21 @@ module ParserTesting } end + def setobj(*names) + args = {} + newnames = names.collect do |name| + if name.is_a? AST + name + else + nameobj(name) + end + end + args[:type] = astarray(*newnames) + assert_nothing_raised("Could not create class %s" % names.inspect) { + return AST::Set.new(args) + } + end + def compobj(name, args = {}) args[:file] ||= tempfile() args[:line] ||= rand(100) @@ -851,6 +866,16 @@ module ParserTesting } end + def varref(name) + assert_nothing_raised("Could not create %s variable" % name) { + return AST::Variable.new( + :file => __FILE__, + :line => __LINE__, + :value => name + ) + } + end + def argobj(name, value) assert_nothing_raised("Could not create %s compargument" % name) { return AST::CompArgument.new( |
