Skip to content
Permalink
Browse files

Merge pull request #611 from modcloth/mbh/internal-test-ruby-string-w…

…hitespace-reformatting

Adjusting whitespace in a bunch of internal test Ruby strings
  • Loading branch information
alex committed Apr 12, 2013
2 parents 2dad178 + 094c5d9 commit 04167128f71d73bad92c615a66fceeacb5f68f9e
@@ -5,22 +5,22 @@ class TestEnumberable(BaseTopazTest):
def test_inject(self, space):
w_res = space.execute("""
return (5..10).inject(1) do |prod, n|
prod * n
prod * n
end
""")
assert space.int_w(w_res) == 151200

w_res = space.execute("""
return (1..10).inject(0) do |sum, n|
sum + n
sum + n
end
""")
assert space.int_w(w_res) == 55

def test_reduce(self, space):
w_res = space.execute("""
return [1, 2, 4, 8].reduce(0) do |accum, cur|
accum + cur
accum + cur
end
""")
assert space.int_w(w_res) == 15
@@ -29,7 +29,7 @@ def test_each_with_index(self, space):
w_res = space.execute("""
result = []
(5..10).each_with_index do |n, idx|
result << [n, idx]
result << [n, idx]
end
return result
""")
@@ -38,15 +38,15 @@ def test_each_with_index(self, space):
def test_all(self, space):
w_res = space.execute("""
return ["ant", "bear", "cat"].all? do |word|
word.length > 2
word.length > 2
end
""")
assert w_res is space.w_true

def test_all_false(self, space):
w_res = space.execute("""
return ["ant", "bear", "cat"].all? do |word|
word.length > 3
word.length > 3
end
""")
assert w_res is space.w_false
@@ -66,7 +66,7 @@ def test_all_no_block(self, space):
def test_any(self, space):
w_res = space.execute("""
return ["ant", "bear", "cat"].any? do |word|
word.length > 2
word.length > 2
end
""")
assert w_res is space.w_true
@@ -126,15 +126,15 @@ def test_to_a(self, space):

w_res = space.execute("""
class A
include Enumerable
def each
i = 0
while i < 5
yield i
i += 1
end
include Enumerable
def each
i = 0
while i < 5
yield i
i += 1
end
end
end
return A.new.to_a""")
assert self.unwrap(space, w_res) == [0, 1, 2, 3, 4]
@@ -198,9 +198,9 @@ def test_loop(self, space):
res = []
i = 0
loop {
i += 1
res << i
break if i == 3
i += 1
res << i
break if i == 3
}
return res
""")
@@ -279,7 +279,7 @@ def test_simple(self, space, tmpdir):
f = tmpdir.join("t.rb")
f.write("""
def t(a, b)
a - b
a - b
end
""")
w_res = space.execute("""
@@ -293,7 +293,7 @@ def test_no_ext(self, space, tmpdir):
f = tmpdir.join("t.rb")
f.write("""
def t(a, b)
a - b
a - b
end
""")
w_res = space.execute("""
@@ -307,7 +307,7 @@ def test_load_path(self, space, tmpdir):
f = tmpdir.join("t.rb")
f.write("""
def t(a, b)
a - b
a - b
end
""")
w_res = space.execute("""
@@ -458,7 +458,7 @@ def test_class(self, space):
w_res = space.execute("""
output = []
set_trace_func proc { |event, file, line, id, binding, classname|
output << [event, file, line, id, classname]
output << [event, file, line, id, classname]
}
class << self
@@ -14,7 +14,7 @@ class X
w_res = space.execute("""
names = []
ObjectSpace.each_object(Module) do |mod|
names << mod.name
names << mod.name
end
return names.include? "X"
""")
@@ -41,7 +41,7 @@ def test_fork(self, space, monkeypatch, capfd):
with self.raises(space, "SystemExit"):
space.execute("""
Process.fork do
puts "child"
puts "child"
end
""")
out, err = capfd.readouterr()
@@ -50,7 +50,7 @@ def test_fork(self, space, monkeypatch, capfd):
monkeypatch.setattr(process, "fork", lambda: 200)
w_res = space.execute("""
return Process.fork do
puts "child"
puts "child"
end
""")
assert space.int_w(w_res) == 200
@@ -307,12 +307,12 @@ def test_eq(self, space):
w_res = space.execute("""
x = []
return [
[] == :abc,
[] == [],
[:abc] == [:abc],
x == (x << 2),
[1, 2, 3] == [1, 2, 4],
[1] == [1, 2],
[] == :abc,
[] == [],
[:abc] == [:abc],
x == (x << 2),
[1, 2, 3] == [1, 2, 4],
[1] == [1, 2],
]
""")
assert self.unwrap(space, w_res) == [False, True, True, True, False, False]
@@ -20,7 +20,7 @@ def test_local_in_binding(self, space):
def test_in_block(self, space):
w_res = space.execute("""
def f(a, b)
return proc { binding }
return proc { binding }
end
return f(3, 4).call.eval("a + b")
@@ -9,10 +9,10 @@ def test_name(self, space):
def test_generated_subclass(self, space):
w_res = space.execute("""
class Foo
class Bar
class Baz
end
class Bar
class Baz
end
end
end
return Foo::Bar::Baz.name
""")
@@ -70,9 +70,9 @@ class X

w_res = space.execute("""
class X
def m
self
end
def m
self
end
end
x = X.new
@@ -91,11 +91,11 @@ def test_superclass(self, space):
def test_attr_accessor(self, space):
w_res = space.execute("""
class X
attr_accessor :a, :b, :c
def initialize a
@a = a
self.b = 25
end
attr_accessor :a, :b, :c
def initialize a
@a = a
self.b = 25
end
end
x = X.new(3)
@@ -108,10 +108,10 @@ def initialize a
def test_attr_reader(self, space):
w_res = space.execute("""
class X
attr_reader :a
def initialize
@a = 5
end
attr_reader :a
def initialize
@a = 5
end
end
return X.new.a
""")
@@ -43,7 +43,7 @@ def test_chdir(self, space, tmpdir, monkeypatch):
dirs = []
dirs << Dir.pwd
Dir.chdir('%s') do
dirs << Dir.pwd
dirs << Dir.pwd
end
dirs << Dir.pwd
return dirs
@@ -54,7 +54,7 @@ def test_chdir(self, space, tmpdir, monkeypatch):
monkeypatch.setenv("HOME", str(tmpdir))
w_res = space.execute("""
Dir.chdir do
return Dir.pwd
return Dir.pwd
end
""")

@@ -69,45 +69,45 @@ def test_glob(self, space, tmpdir):
sub2.join("sub2content2").ensure()
w_res = space.execute("""
Dir.chdir('%s') do
return Dir['*']
return Dir['*']
end
""" % tmpdir)
res = self.unwrap(space, w_res)
res.sort()
assert res == ["sub1", "sub2"]
w_res = space.execute("""
Dir.chdir('%s') do
return Dir['**/*']
return Dir['**/*']
end
""" % tmpdir)
res = self.unwrap(space, w_res)
res.sort()
assert res == ["sub1", "sub1/sub1content1", "sub1/sub1content2", "sub2", "sub2/sub2content1", "sub2/sub2content2"]
w_res = space.execute("""
Dir.chdir('%s') do
return Dir['**/*{1con}*']
return Dir['**/*{1con}*']
end
""" % tmpdir)
res = self.unwrap(space, w_res)
res.sort()
assert res == ["sub1/sub1content1", "sub1/sub1content2"]
w_res = space.execute("""
Dir.chdir('%s') do
return Dir['**/sub[1]content[12]']
return Dir['**/sub[1]content[12]']
end
""" % tmpdir)
res = self.unwrap(space, w_res)
res.sort()
assert res == ["sub1/sub1content1", "sub1/sub1content2"]
w_res = space.execute("""
Dir.chdir('%s') do
return Dir['%s/']
return Dir['%s/']
end
""" % (tmpdir, tmpdir.join("..")))
assert self.unwrap(space, w_res) == [str(tmpdir.join("..")) + "/"]
w_res = space.execute("""
Dir.chdir('%s') do
return Dir["sub1\\0foo", "sub\\02bar"], Dir["sub1\\0foo"]
return Dir["sub1\\0foo", "sub\\02bar"], Dir["sub1\\0foo"]
end
""" % tmpdir)
res = self.unwrap(space, w_res)

0 comments on commit 0416712

Please sign in to comment.
You can’t perform that action at this time.