diff options
| author | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-11-26 09:55:04 +0000 |
|---|---|---|
| committer | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-11-26 09:55:04 +0000 |
| commit | ccd7b581bf990df618d410441c1f8d349aa225d9 (patch) | |
| tree | 768e134483b5ed8f82adc69eebba7e8a7146b55e /test/lib | |
| parent | c301b1b8f7fb417cf61b6ad4975eaa3714100306 (diff) | |
| download | puppet-ccd7b581bf990df618d410441c1f8d349aa225d9.tar.gz puppet-ccd7b581bf990df618d410441c1f8d349aa225d9.tar.xz puppet-ccd7b581bf990df618d410441c1f8d349aa225d9.zip | |
Intermediate commit -- I am ready to start pushing the graph stuff into the types and transactions, which will break everything for a little while.
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1894 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'test/lib')
| -rwxr-xr-x | test/lib/puppettest.rb | 6 | ||||
| -rw-r--r-- | test/lib/puppettest/graph.rb | 40 |
2 files changed, 44 insertions, 2 deletions
diff --git a/test/lib/puppettest.rb b/test/lib/puppettest.rb index 05d59a3a7..6e3d8cd4c 100755 --- a/test/lib/puppettest.rb +++ b/test/lib/puppettest.rb @@ -11,9 +11,11 @@ module PuppetTest # the parent of that dir. def basedir(*list) unless defined? @@basedir - case $0 - when /rake_test_loader/ + case + when $0 =~ /rake_test_loader/ @@basedir = File.dirname(Dir.getwd) + when ENV['BASEDIR'] + @@basedir = ENV['BASEDIR'] else dir = nil app = $0.sub /^\.\//, "" diff --git a/test/lib/puppettest/graph.rb b/test/lib/puppettest/graph.rb new file mode 100644 index 000000000..a6d0069cc --- /dev/null +++ b/test/lib/puppettest/graph.rb @@ -0,0 +1,40 @@ +#!/usr/bin/env ruby +# +# Created by Luke A. Kanies on 2006-11-24. +# Copyright (c) 2006. All rights reserved. + +require 'puppet/util/graph' + +class Container + include Puppet::Util::Graph + include Enumerable + attr_accessor :name + def each + @children.each do |c| yield c end + end + + def initialize(name, ary) + @name = name + @children = ary + end + + def push(*ary) + ary.each { |c| @children.push(c)} + end + + def to_s + @name + end +end + +module PuppetTest::Graph + def build_tree + one = Container.new("one", %w{a b}) + two = Container.new("two", ["c", "d"]) + middle = Container.new("middle", ["e", "f", two]) + top = Container.new("top", ["g", "h", middle, one]) + return one, two, middle, top + end +end + +# $Id$
\ No newline at end of file |
