Sha256: b545cfff5fbaf6d08c85e24ec654df707a543b8af04b15466bb23725270d6a20
Contents?: true
Size: 1.05 KB
Versions: 4
Compression:
Stored size: 1.05 KB
Contents
module PuppetTest::FileParsing # Run an isomorphism test on our parsing process. def fakedataparse(*files) files.each do |file| oldtarget = @provider.default_target cleanup do @provider.default_target = oldtarget end @provider.default_target = file assert_nothing_raised("failed to fetch %s" % file) { @provider.prefetch } text = nil assert_nothing_raised("failed to generate %s" % file) do text = @provider.to_file(@provider.target_records(file)) end text.gsub!(/^# HEADER.+\n/, '') yield if block_given? 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 in %s" % file) end end end end # $Id: fileparsing.rb 2296 2007-03-18 22:48:57Z luke $
Version data entries
4 entries across 4 versions & 1 rubygems