From bd169b44a0ce58413fb5b031c3f12cd4ca6f4cbe Mon Sep 17 00:00:00 2001 From: luke Date: Sun, 12 Nov 2006 04:12:48 +0000 Subject: Mounts work again, at least with the parsedfile provider. I still need to create a netinfo provider, but it should be short and easy. And, painfully, I still need to port the other six or so subclasses to this new provider. git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1859 980ebf18-57e1-0310-9a29-db15c13687c0 --- test/lib/puppettest/fileparsing.rb | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) (limited to 'test/lib') diff --git a/test/lib/puppettest/fileparsing.rb b/test/lib/puppettest/fileparsing.rb index 004a0c3b5..9f8124df5 100644 --- a/test/lib/puppettest/fileparsing.rb +++ b/test/lib/puppettest/fileparsing.rb @@ -1,28 +1,26 @@ module PuppetTest::FileParsing # Run an isomorphism test on our parsing process. def fakedataparse(file) - @provider.path = file - instances = nil + oldtarget = @provider.default_target + cleanup do + @provider.default_target = oldtarget + end + @provider.default_target = file + assert_nothing_raised { - instances = @provider.retrieve + @provider.prefetch } - text = @provider.fileobj.read + text = @provider.to_file(@provider.target_records(file)) yield if block_given? - dest = tempfile() - @provider.path = dest - - # Now write it back out - assert_nothing_raised { - @provider.store(instances) - } - - newtext = @provider.fileobj.read - - # Don't worry about difference in whitespace - assert_equal(text.gsub(/\s+/, ' '), newtext.gsub(/\s+/, ' ')) + oldlines = File.readlines(file) + newlines = text.chomp.split "\n" + oldlines.zip(newlines).each do |old, new| + assert_equal(old.chomp.gsub(/\s+/, ''), new.gsub(/\s+/, ''), + "Lines are not equal") + end end end -- cgit