summaryrefslogtreecommitdiffstats
path: root/test/language
diff options
context:
space:
mode:
authorMarkus Roberts <Markus@reality.com>2010-07-09 18:05:04 -0700
committerMarkus Roberts <Markus@reality.com>2010-07-09 18:05:04 -0700
commit9ee56f2e67be973da49b1d3f21de1bf87de35e6f (patch)
treeddab8c01509f47664c52c8a6b165bb5a974f138f /test/language
parent051bd98751d9d4bc97f93f66723d9b7a00c0cfb4 (diff)
downloadpuppet-9ee56f2e67be973da49b1d3f21de1bf87de35e6f.tar.gz
puppet-9ee56f2e67be973da49b1d3f21de1bf87de35e6f.tar.xz
puppet-9ee56f2e67be973da49b1d3f21de1bf87de35e6f.zip
Code smell: Inconsistent indentation and related formatting issues
* Replaced 163 occurances of defined\? +([@a-zA-Z_.0-9?=]+) with defined?(\1) This makes detecting subsequent patterns easier. 3 Examples: The code: if ! defined? @parse_config becomes: if ! defined?(@parse_config) The code: return @option_parser if defined? @option_parser becomes: return @option_parser if defined?(@option_parser) The code: if defined? @local and @local becomes: if defined?(@local) and @local * Eliminate trailing spaces. Replaced 428 occurances of ^(.*?) +$ with \1 1 file was skipped. test/ral/providers/host/parsed.rb because 0 * Replace leading tabs with an appropriate number of spaces. Replaced 306 occurances of ^(\t+)(.*) with Tabs are not consistently expanded in all environments. * Don't arbitrarily wrap on sprintf (%) operator. Replaced 143 occurances of (.*['"] *%) +(.*) with Splitting the line does nothing to aid clarity and hinders further refactorings. 3 Examples: The code: raise Puppet::Error, "Cannot create %s: basedir %s is a file" % [dir, File.join(path)] becomes: raise Puppet::Error, "Cannot create %s: basedir %s is a file" % [dir, File.join(path)] The code: Puppet.err "Will not start without authorization file %s" % Puppet[:authconfig] becomes: Puppet.err "Will not start without authorization file %s" % Puppet[:authconfig] The code: $stderr.puts "Could not find host for PID %s with status %s" % [pid, $?.exitstatus] becomes: $stderr.puts "Could not find host for PID %s with status %s" % [pid, $?.exitstatus] * Don't break short arrays/parameter list in two. Replaced 228 occurances of (.*) +(.*) with 3 Examples: The code: puts @format.wrap(type.provider(prov).doc, :indent => 4, :scrub => true) becomes: puts @format.wrap(type.provider(prov).doc, :indent => 4, :scrub => true) The code: assert(FileTest.exists?(daily), "Did not make daily graph for %s" % type) becomes: assert(FileTest.exists?(daily), "Did not make daily graph for %s" % type) The code: assert(prov.target_object(:first).read !~ /^notdisk/, "Did not remove thing from disk") becomes: assert(prov.target_object(:first).read !~ /^notdisk/, "Did not remove thing from disk") * If arguments must wrap, treat them all equally Replaced 510 occurances of lines ending in things like ...(foo, or ...(bar(1,3), with \1 \2 3 Examples: The code: midscope.to_hash(false), becomes: assert_equal( The code: botscope.to_hash(true), becomes: # bottomscope, then checking that we see the right stuff. The code: :path => link, becomes: * Replaced 4516 occurances of ^( *)(.*) with The present code base is supposed to use four-space indentation. In some places we failed to maintain that standard. These should be fixed regardless of the 2 vs. 4 space question. 15 Examples: The code: def run_comp(cmd) puts cmd results = [] old_sync = $stdout.sync $stdout.sync = true line = [] begin open("| #{cmd}", "r") do |f| until f.eof? do c = f.getc becomes: def run_comp(cmd) puts cmd results = [] old_sync = $stdout.sync $stdout.sync = true line = [] begin open("| #{cmd}", "r") do |f| until f.eof? do c = f.getc The code: s.gsub!(/.{4}/n, '\\\\u\&') } string.force_encoding(Encoding::UTF_8) string rescue Iconv::Failure => e raise GeneratorError, "Caught #{e.class}: #{e}" end else def utf8_to_pson(string) # :nodoc: string = string.gsub(/["\\\x0-\x1f]/) { MAP[$&] } string.gsub!(/( becomes: s.gsub!(/.{4}/n, '\\\\u\&') } string.force_encoding(Encoding::UTF_8) string rescue Iconv::Failure => e raise GeneratorError, "Caught #{e.class}: #{e}" end else def utf8_to_pson(string) # :nodoc: string = string.gsub(/["\\\x0-\x1f]/) { MAP[$&] } string.gsub!(/( The code: end } rvalues: rvalue | rvalues comma rvalue { if val[0].instance_of?(AST::ASTArray) result = val[0].push(val[2]) else result = ast AST::ASTArray, :children => [val[0],val[2]] end } becomes: end } rvalues: rvalue | rvalues comma rvalue { if val[0].instance_of?(AST::ASTArray) result = val[0].push(val[2]) else result = ast AST::ASTArray, :children => [val[0],val[2]] end } The code: #passwdproc = proc { @password } keytext = @key.export( OpenSSL::Cipher::DES.new(:EDE3, :CBC), @password ) File.open(@keyfile, "w", 0400) { |f| f << keytext } becomes: # passwdproc = proc { @password } keytext = @key.export( OpenSSL::Cipher::DES.new(:EDE3, :CBC), @password ) File.open(@keyfile, "w", 0400) { |f| f << keytext } The code: end def to_manifest "%s { '%s':\n%s\n}" % [self.type.to_s, self.name, @params.collect { |p, v| if v.is_a? Array " #{p} => [\'#{v.join("','")}\']" else " #{p} => \'#{v}\'" end }.join(",\n") becomes: end def to_manifest "%s { '%s':\n%s\n}" % [self.type.to_s, self.name, @params.collect { |p, v| if v.is_a? Array " #{p} => [\'#{v.join("','")}\']" else " #{p} => \'#{v}\'" end }.join(",\n") The code: via the augeas tool. Requires: - augeas to be installed (http://www.augeas.net) - ruby-augeas bindings Sample usage with a string:: augeas{\"test1\" : context => \"/files/etc/sysconfig/firstboot\", changes => \"set RUN_FIRSTBOOT YES\", becomes: via the augeas tool. Requires: - augeas to be installed (http://www.augeas.net) - ruby-augeas bindings Sample usage with a string:: augeas{\"test1\" : context => \"/files/etc/sysconfig/firstboot\", changes => \"set RUN_FIRSTBOOT YES\", The code: names.should_not be_include("root") end describe "when generating a purgeable resource" do it "should be included in the generated resources" do Puppet::Type.type(:host).stubs(:instances).returns [@purgeable_resource] @resources.generate.collect { |r| r.ref }.should include(@purgeable_resource.ref) end end describe "when the instance's do not have an ensure property" do becomes: names.should_not be_include("root") end describe "when generating a purgeable resource" do it "should be included in the generated resources" do Puppet::Type.type(:host).stubs(:instances).returns [@purgeable_resource] @resources.generate.collect { |r| r.ref }.should include(@purgeable_resource.ref) end end describe "when the instance's do not have an ensure property" do The code: describe "when the instance's do not have an ensure property" do it "should not be included in the generated resources" do @no_ensure_resource = Puppet::Type.type(:exec).new(:name => '/usr/bin/env echo') Puppet::Type.type(:host).stubs(:instances).returns [@no_ensure_resource] @resources.generate.collect { |r| r.ref }.should_not include(@no_ensure_resource.ref) end end describe "when the instance's ensure property does not accept absent" do it "should not be included in the generated resources" do @no_absent_resource = Puppet::Type.type(:service).new(:name => 'foobar') becomes: describe "when the instance's do not have an ensure property" do it "should not be included in the generated resources" do @no_ensure_resource = Puppet::Type.type(:exec).new(:name => '/usr/bin/env echo') Puppet::Type.type(:host).stubs(:instances).returns [@no_ensure_resource] @resources.generate.collect { |r| r.ref }.should_not include(@no_ensure_resource.ref) end end describe "when the instance's ensure property does not accept absent" do it "should not be included in the generated resources" do @no_absent_resource = Puppet::Type.type(:service).new(:name => 'foobar') The code: func = nil assert_nothing_raised do func = Puppet::Parser::AST::Function.new( :name => "template", :ftype => :rvalue, :arguments => AST::ASTArray.new( :children => [stringobj(template)] ) becomes: func = nil assert_nothing_raised do func = Puppet::Parser::AST::Function.new( :name => "template", :ftype => :rvalue, :arguments => AST::ASTArray.new( :children => [stringobj(template)] ) The code: assert( @store.allowed?("hostname.madstop.com", "192.168.1.50"), "hostname not allowed") assert( ! @store.allowed?("name.sub.madstop.com", "192.168.0.50"), "subname name allowed") becomes: assert( @store.allowed?("hostname.madstop.com", "192.168.1.50"), "hostname not allowed") assert( ! @store.allowed?("name.sub.madstop.com", "192.168.0.50"), "subname name allowed") The code: assert_nothing_raised { server = Puppet::Network::Handler.fileserver.new( :Local => true, :Config => false ) } becomes: assert_nothing_raised { server = Puppet::Network::Handler.fileserver.new( :Local => true, :Config => false ) } The code: 'yay', { :failonfail => false, :uid => @user.uid, :gid => @user.gid } ).returns('output') output = Puppet::Util::SUIDManager.run_and_capture 'yay', @user.uid, @user.gid becomes: 'yay', { :failonfail => false, :uid => @user.uid, :gid => @user.gid } ).returns('output') output = Puppet::Util::SUIDManager.run_and_capture 'yay', @user.uid, @user.gid The code: ).times(1) pkg.provider.expects( :aptget ).with( '-y', '-q', 'remove', 'faff' becomes: ).times(1) pkg.provider.expects( :aptget ).with( '-y', '-q', 'remove', 'faff' The code: johnny one two billy three four\n" # Just parse and generate, to make sure it's isomorphic. assert_nothing_raised do assert_equal(text, @parser.to_file(@parser.parse(text)), "parsing was not isomorphic") end end def test_valid_attrs becomes: johnny one two billy three four\n" # Just parse and generate, to make sure it's isomorphic. assert_nothing_raised do assert_equal(text, @parser.to_file(@parser.parse(text)), "parsing was not isomorphic") end end def test_valid_attrs The code: "testing", :onboolean => [true, "An on bool"], :string => ["a string", "A string arg"] ) result = [] should = [] assert_nothing_raised("Add args failed") do @config.addargs(result) end @config.each do |name, element| becomes: "testing", :onboolean => [true, "An on bool"], :string => ["a string", "A string arg"] ) result = [] should = [] assert_nothing_raised("Add args failed") do @config.addargs(result) end @config.each do |name, element|
Diffstat (limited to 'test/language')
-rwxr-xr-xtest/language/ast.rb5
-rwxr-xr-xtest/language/functions.rb71
-rwxr-xr-xtest/language/parser.rb9
-rwxr-xr-xtest/language/scope.rb105
-rwxr-xr-xtest/language/snippets.rb26
-rwxr-xr-xtest/language/transportable.rb5
6 files changed, 147 insertions, 74 deletions
diff --git a/test/language/ast.rb b/test/language/ast.rb
index a4d4d8773..d11c87f6d 100755
--- a/test/language/ast.rb
+++ b/test/language/ast.rb
@@ -23,9 +23,12 @@ class TestAST < Test::Unit::TestCase
astelse = AST::Else.new(:statements => fakeelse)
}
assert_nothing_raised {
- astif = AST::IfStatement.new(
+
+ astif = AST::IfStatement.new(
+
:test => faketest,
:statements => fakeif,
+
:else => astelse
)
}
diff --git a/test/language/functions.rb b/test/language/functions.rb
index 5463cf256..a9d7c1a7f 100755
--- a/test/language/functions.rb
+++ b/test/language/functions.rb
@@ -14,8 +14,11 @@ class TestLangFunctions < Test::Unit::TestCase
def test_functions
Puppet::Node::Environment.stubs(:current).returns nil
assert_nothing_raised do
+
Puppet::Parser::AST::Function.new(
+
:name => "fakefunction",
+
:arguments => AST::ASTArray.new(
:children => [nameobj("avalue")]
)
@@ -23,8 +26,11 @@ class TestLangFunctions < Test::Unit::TestCase
end
assert_raise(Puppet::ParseError) do
+
func = Puppet::Parser::AST::Function.new(
+
:name => "fakefunction",
+
:arguments => AST::ASTArray.new(
:children => [nameobj("avalue")]
)
@@ -40,9 +46,12 @@ class TestLangFunctions < Test::Unit::TestCase
func = nil
assert_nothing_raised do
+
func = Puppet::Parser::AST::Function.new(
+
:name => "fakefunction",
:ftype => :rvalue,
+
:arguments => AST::ASTArray.new(
:children => [nameobj("avalue")]
)
@@ -84,12 +93,14 @@ class TestLangFunctions < Test::Unit::TestCase
def test_failfunction
func = nil
assert_nothing_raised do
+
func = Puppet::Parser::AST::Function.new(
+
:name => "fail",
:ftype => :statement,
+
:arguments => AST::ASTArray.new(
- :children => [stringobj("this is a failure"),
- stringobj("and another")]
+ :children => [stringobj("this is a failure"), stringobj("and another")]
)
)
end
@@ -116,12 +127,14 @@ class TestLangFunctions < Test::Unit::TestCase
end
func = nil
assert_nothing_raised do
+
func = Puppet::Parser::AST::Function.new(
+
:name => "template",
:ftype => :rvalue,
+
:arguments => AST::ASTArray.new(
- :children => [stringobj("one"),
- stringobj("two")]
+ :children => [stringobj("one"), stringobj("two")]
)
)
end
@@ -142,8 +155,7 @@ class TestLangFunctions < Test::Unit::TestCase
end
# Ensure that we got the output we expected from that evaluation.
- assert_equal("template One\ntemplate \n", scope.lookupvar("output"),
- "Undefined template variables do not raise exceptions")
+ assert_equal("template One\ntemplate \n", scope.lookupvar("output"), "Undefined template variables do not raise exceptions")
# Now, fill in the last variable and make sure the whole thing
# evaluates correctly.
@@ -153,7 +165,10 @@ class TestLangFunctions < Test::Unit::TestCase
ast.evaluate(scope)
end
- assert_equal("template One\ntemplate Two\n", scope.lookupvar("output"),
+
+ assert_equal(
+ "template One\ntemplate Two\n", scope.lookupvar("output"),
+
"Templates were not handled correctly")
end
@@ -167,9 +182,12 @@ class TestLangFunctions < Test::Unit::TestCase
func = nil
assert_nothing_raised do
+
func = Puppet::Parser::AST::Function.new(
+
:name => "template",
:ftype => :rvalue,
+
:arguments => AST::ASTArray.new(
:children => [stringobj(template)]
)
@@ -188,7 +206,10 @@ class TestLangFunctions < Test::Unit::TestCase
ast.evaluate(scope)
end
- assert_equal("template this is yay\n", scope.lookupvar("output"),
+
+ assert_equal(
+ "template this is yay\n", scope.lookupvar("output"),
+
"Templates were not handled correctly")
end
@@ -203,9 +224,12 @@ class TestLangFunctions < Test::Unit::TestCase
func = nil
assert_nothing_raised do
+
func = Puppet::Parser::AST::Function.new(
+
:name => "template",
:ftype => :rvalue,
+
:arguments => AST::ASTArray.new(
:children => [stringobj(template)]
)
@@ -225,8 +249,11 @@ class TestLangFunctions < Test::Unit::TestCase
ast.evaluate(scope)
end
- assert_equal("template deprecated value\n", scope.lookupvar("output"),
- "Deprecated template variables were not handled correctly")
+
+ assert_equal(
+ "template deprecated value\n", scope.lookupvar("output"),
+
+ "Deprecated template variables were not handled correctly")
end
# Make sure that problems with kernel method visibility still exist.
@@ -236,9 +263,12 @@ class TestLangFunctions < Test::Unit::TestCase
func = nil
assert_nothing_raised do
+
func = Puppet::Parser::AST::Function.new(
+
:name => "template",
:ftype => :rvalue,
+
:arguments => AST::ASTArray.new(
:children => [stringobj(template)]
)
@@ -262,9 +292,12 @@ class TestLangFunctions < Test::Unit::TestCase
func = nil
assert_nothing_raised do
+
func = Puppet::Parser::AST::Function.new(
+
:name => "template",
:ftype => :rvalue,
+
:arguments => AST::ASTArray.new(
:children => [stringobj(template)]
)
@@ -302,7 +335,10 @@ class TestLangFunctions < Test::Unit::TestCase
fileobj = catalog.vertices.find { |r| r.title == file }
assert(fileobj, "File was not in catalog")
- assert_equal("original text\n", fileobj["content"],
+
+ assert_equal(
+ "original text\n", fileobj["content"],
+
"Template did not work")
Puppet[:filetimeout] = -5
@@ -328,9 +364,12 @@ class TestLangFunctions < Test::Unit::TestCase
func = nil
assert_nothing_raised do
+
func = Puppet::Parser::AST::Function.new(
+
:name => "template",
:ftype => :rvalue,
+
:arguments => AST::ASTArray.new(
:children => [stringobj(template)]
)
@@ -350,8 +389,11 @@ class TestLangFunctions < Test::Unit::TestCase
ast.evaluate(scope)
end
- assert_equal("template #{value}\n", scope.lookupvar("output"),
- "%s did not get evaluated correctly" % string.inspect)
+
+ assert_equal(
+ "template #{value}\n", scope.lookupvar("output"),
+
+ "%s did not get evaluated correctly" % string.inspect)
end
end
@@ -378,8 +420,7 @@ class TestLangFunctions < Test::Unit::TestCase
}
assert(obj, "Did not autoload function")
- assert(Puppet::Parser::Functions.environment_module.method_defined?(:function_autofunc),
- "Did not set function correctly")
+ assert(Puppet::Parser::Functions.environment_module.method_defined?(:function_autofunc), "Did not set function correctly")
end
def test_search
diff --git a/test/language/parser.rb b/test/language/parser.rb
index 18688aa40..b26982d16 100755
--- a/test/language/parser.rb
+++ b/test/language/parser.rb
@@ -80,8 +80,7 @@ class TestParser < Test::Unit::TestCase
@@tmpfiles << name
File.open(file, "w") { |f|
- f.puts "file { \"%s\": ensure => file, mode => 755 }\n" %
- name
+ f.puts "file { \"%s\": ensure => file, mode => 755 }\n" % name
}
end
@@ -673,8 +672,7 @@ file { "/tmp/yayness":
end
[one, two].each do |file|
- assert(@logs.detect { |l| l.message =~ /importing '#{file}'/},
- "did not import %s" % file)
+ assert(@logs.detect { |l| l.message =~ /importing '#{file}'/}, "did not import %s" % file)
end
end
@@ -743,7 +741,6 @@ file { "/tmp/yayness":
assert_nothing_raised do
result = parser.newdefine "FunTest"
end
- assert_equal(result, parser.find_definition("", "fUntEst"),
- "%s was not matched" % "fUntEst")
+ assert_equal(result, parser.find_definition("", "fUntEst"), "%s was not matched" % "fUntEst")
end
end
diff --git a/test/language/scope.rb b/test/language/scope.rb
index 0bed35c14..16149a6be 100755
--- a/test/language/scope.rb
+++ b/test/language/scope.rb
@@ -63,29 +63,40 @@ class TestScope < Test::Unit::TestCase
# Test that the scopes convert to hash structures correctly.
# For topscope recursive vs non-recursive should be identical
assert_equal(topscope.to_hash(false), topscope.to_hash(true),
- "Recursive and non-recursive hash is identical for topscope")
+ "Recursive and non-recursive hash is identical for topscope")
# Check the variable we expect is present.
- assert_equal({"first" => "topval"}, topscope.to_hash(),
- "topscope returns the expected hash of variables")
+ assert_equal({"first" => "topval"}, topscope.to_hash(), "topscope returns the expected hash of variables")
# Now, check that midscope does the right thing in all cases.
- assert_equal({"second" => "midval"},
- midscope.to_hash(false),
- "midscope non-recursive hash contains only midscope variable")
- assert_equal({"first" => "topval", "second" => "midval"},
- midscope.to_hash(true),
- "midscope recursive hash contains topscope variable also")
+
+ assert_equal(
+ {"second" => "midval"},
+ midscope.to_hash(false),
+
+ "midscope non-recursive hash contains only midscope variable")
+
+ assert_equal(
+ {"first" => "topval", "second" => "midval"},
+ midscope.to_hash(true),
+
+ "midscope recursive hash contains topscope variable also")
# Finally, check the ability to shadow symbols by adding a shadow to
# bottomscope, then checking that we see the right stuff.
botscope.setvar("first", "shadowval")
- assert_equal({"third" => "botval", "first" => "shadowval"},
- botscope.to_hash(false),
- "botscope has the right non-recursive hash")
- assert_equal({"third" => "botval", "first" => "shadowval", "second" => "midval"},
- botscope.to_hash(true),
- "botscope values shadow parent scope values")
+
+ assert_equal(
+ {"third" => "botval", "first" => "shadowval"},
+ botscope.to_hash(false),
+
+ "botscope has the right non-recursive hash")
+
+ assert_equal(
+ {"third" => "botval", "first" => "shadowval", "second" => "midval"},
+ botscope.to_hash(true),
+
+ "botscope values shadow parent scope values")
end
def test_declarative
@@ -120,15 +131,30 @@ class TestScope < Test::Unit::TestCase
# Make sure we know what we consider to be truth.
def test_truth
- assert_equal(true, Puppet::Parser::Scope.true?("a string"),
+
+ assert_equal(
+ true, Puppet::Parser::Scope.true?("a string"),
+
"Strings not considered true")
- assert_equal(true, Puppet::Parser::Scope.true?(true),
+
+ assert_equal(
+ true, Puppet::Parser::Scope.true?(true),
+
"True considered true")
- assert_equal(false, Puppet::Parser::Scope.true?(""),
+
+ assert_equal(
+ false, Puppet::Parser::Scope.true?(""),
+
"Empty strings considered true")
- assert_equal(false, Puppet::Parser::Scope.true?(false),
+
+ assert_equal(
+ false, Puppet::Parser::Scope.true?(false),
+
"false considered true")
- assert_equal(false, Puppet::Parser::Scope.true?(:undef),
+
+ assert_equal(
+ false, Puppet::Parser::Scope.true?(:undef),
+
"undef considered true")
end
@@ -195,15 +221,15 @@ include yay
@@host { puppet: ip => \"192.168.0.3\" }
Host <<||>>"
- config = nil
- # We run it twice because we want to make sure there's no conflict
- # if we pull it up from the database.
- node = mknode
- node.merge "hostname" => node.name
- 2.times { |i|
- catalog = Puppet::Parser::Compiler.new(node).compile
- assert_instance_of(Puppet::Parser::Resource, catalog.resource(:host, "puppet"))
- assert_instance_of(Puppet::Parser::Resource, catalog.resource(:host, "myhost"))
+ config = nil
+ # We run it twice because we want to make sure there's no conflict
+ # if we pull it up from the database.
+ node = mknode
+ node.merge "hostname" => node.name
+ 2.times { |i|
+ catalog = Puppet::Parser::Compiler.new(node).compile
+ assert_instance_of(Puppet::Parser::Resource, catalog.resource(:host, "puppet"))
+ assert_instance_of(Puppet::Parser::Resource, catalog.resource(:host, "myhost"))
}
ensure
Puppet[:storeconfigs] = false
@@ -218,14 +244,15 @@ Host <<||>>"
def test_namespaces
scope = mkscope
- assert_equal([""], scope.namespaces,
+
+ assert_equal(
+ [""], scope.namespaces,
+
"Started out with incorrect namespaces")
assert_nothing_raised { scope.add_namespace("fun::test") }
- assert_equal(["fun::test"], scope.namespaces,
- "Did not add namespace correctly")
+ assert_equal(["fun::test"], scope.namespaces, "Did not add namespace correctly")
assert_nothing_raised { scope.add_namespace("yay::test") }
- assert_equal(["fun::test", "yay::test"], scope.namespaces,
- "Did not add extra namespace correctly")
+ assert_equal(["fun::test", "yay::test"], scope.namespaces, "Did not add extra namespace correctly")
end
# #629 - undef should be "" or :undef
@@ -234,10 +261,16 @@ Host <<||>>"
scope.setvar("testing", :undef)
- assert_equal(:undef, scope.lookupvar("testing", false),
+
+ assert_equal(
+ :undef, scope.lookupvar("testing", false),
+
"undef was not returned as :undef when not string")
- assert_equal("", scope.lookupvar("testing", true),
+
+ assert_equal(
+ "", scope.lookupvar("testing", true),
+
"undef was not returned as '' when string")
end
end
diff --git a/test/language/snippets.rb b/test/language/snippets.rb
index 0d647f7de..14a267d99 100755
--- a/test/language/snippets.rb
+++ b/test/language/snippets.rb
@@ -412,7 +412,10 @@ class TestSnippets < Test::Unit::TestCase
def snippet_componentrequire
%w{1 2}.each do |num|
- assert_file("/tmp/testing_component_requires#{num}",
+
+ assert_file(
+ "/tmp/testing_component_requires#{num}",
+
"#{num} does not exist")
end
end
@@ -433,29 +436,22 @@ class TestSnippets < Test::Unit::TestCase
end
def snippet_fqdefinition
- assert_file("/tmp/fqdefinition",
- "Did not make file from fully-qualified definition")
+ assert_file("/tmp/fqdefinition", "Did not make file from fully-qualified definition")
end
def snippet_subclass_name_duplication
- assert_file("/tmp/subclass_name_duplication1",
- "Did not make first file from duplicate subclass names")
- assert_file("/tmp/subclass_name_duplication2",
- "Did not make second file from duplicate subclass names")
+ assert_file("/tmp/subclass_name_duplication1", "Did not make first file from duplicate subclass names")
+ assert_file("/tmp/subclass_name_duplication2", "Did not make second file from duplicate subclass names")
end
def snippet_funccomma
- assert_file("/tmp/funccomma1",
- "Did not make first file from trailing function comma")
- assert_file("/tmp/funccomma2",
- "Did not make second file from trailing function comma")
+ assert_file("/tmp/funccomma1", "Did not make first file from trailing function comma")
+ assert_file("/tmp/funccomma2", "Did not make second file from trailing function comma")
end
def snippet_arraytrailingcomma
- assert_file("/tmp/arraytrailingcomma1",
- "Did not make first file from array")
- assert_file("/tmp/arraytrailingcomma2",
- "Did not make second file from array")
+ assert_file("/tmp/arraytrailingcomma1", "Did not make first file from array")
+ assert_file("/tmp/arraytrailingcomma2", "Did not make second file from array")
end
def snippet_multipleclass
diff --git a/test/language/transportable.rb b/test/language/transportable.rb
index 7ea6a176d..247a6eda3 100755
--- a/test/language/transportable.rb
+++ b/test/language/transportable.rb
@@ -78,8 +78,11 @@ class TestTransportable < Test::Unit::TestCase
assert(objects.include?(obj), "Missing obj %s[%s]" % [obj.type, obj.name])
end
- assert_equal(found.length,
+
+ assert_equal(
+ found.length,
top.flatten.find_all { |o| o.file == :funtest }.length,
+
"Found incorrect number of objects")
end
end