babel_bridge 0.4.1 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,44 +0,0 @@
1
- class TestHelper
2
- class AssertionFailure < Exception
3
- end
4
- def assert(val)
5
- raise AssertionFailure.new("assertion failed: expected a value, got #{val.inspect}") unless val
6
- end
7
-
8
- def assert_nil(val)
9
- raise AssertionFailure.new("assertion failed: did not expect a value, got #{val.inspect}") if val
10
- end
11
-
12
- def assert_equal(expected,val)
13
- raise AssertionFailure.new("expected #{expected.inspect}; got #{val.inspect}") if expected!=val
14
- end
15
-
16
- def run_tests(tests=nil)
17
- failures=[]
18
- errors=[]
19
- successes=0
20
- (tests || self.methods).each do |method|
21
- method=method.to_sym
22
- if method.to_s[/^test_/]
23
- begin
24
- self.send(method)
25
- successes+=1
26
- $stdout.write(".");
27
- rescue AssertionFailure => e
28
- errors<<"#{method} failed an assertion: #{e}"+
29
- " "+e.backtrace.join("\n ")+"\n\n"
30
- $stdout.write("E");
31
- rescue Exception => e
32
- failures<<"#{method} had an error: #{e}"+
33
- " "+e.backtrace.join("\n ")+"\n\n"
34
- $stdout.write("F");
35
- end
36
- $stdout.flush()
37
- end
38
- end
39
- puts ""
40
- puts "\n\n"+(errors+failures).join("\n\n")
41
- puts "successes: #{successes}, failures: #{failures.length}, errors: #{errors.length}"
42
- end
43
- end
44
-