babel_bridge 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README +144 -0
- data/babel_bridge.gemspec +14 -0
- data/lib/babel_bridge.rb +529 -0
- data/lib/nodes.rb +256 -0
- data/test/test_bb.rb +387 -0
- data/test/test_helper.rb +44 -0
- metadata +60 -0
data/test/test_helper.rb
ADDED
@@ -0,0 +1,44 @@
|
|
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
|
+
|
metadata
ADDED
@@ -0,0 +1,60 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: babel_bridge
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Shane Brinkman-Davis
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2010-11-28 00:00:00 -08:00
|
13
|
+
default_executable:
|
14
|
+
dependencies: []
|
15
|
+
|
16
|
+
description: Babel Bridge let's you generate parsers 100% in Ruby code. It is a memoizing Parsing Expression Grammar (PEG) generator like Treetop, but it doesn't require special file-types or new syntax. Overall focus is on simplicity and usability over performance.
|
17
|
+
email: shanebdavis@gmail.com
|
18
|
+
executables: []
|
19
|
+
|
20
|
+
extensions: []
|
21
|
+
|
22
|
+
extra_rdoc_files: []
|
23
|
+
|
24
|
+
files:
|
25
|
+
- README
|
26
|
+
- babel_bridge.gemspec
|
27
|
+
- test/test_bb.rb
|
28
|
+
- test/test_helper.rb
|
29
|
+
- lib/babel_bridge.rb
|
30
|
+
- lib/nodes.rb
|
31
|
+
has_rdoc: true
|
32
|
+
homepage: http://babel-bridge.rubyforge.org
|
33
|
+
licenses: []
|
34
|
+
|
35
|
+
post_install_message:
|
36
|
+
rdoc_options: []
|
37
|
+
|
38
|
+
require_paths:
|
39
|
+
- lib
|
40
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
41
|
+
requirements:
|
42
|
+
- - ">="
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
version: "0"
|
45
|
+
version:
|
46
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
47
|
+
requirements:
|
48
|
+
- - ">="
|
49
|
+
- !ruby/object:Gem::Version
|
50
|
+
version: "0"
|
51
|
+
version:
|
52
|
+
requirements: []
|
53
|
+
|
54
|
+
rubyforge_project: babel-bridge
|
55
|
+
rubygems_version: 1.3.5
|
56
|
+
signing_key:
|
57
|
+
specification_version: 3
|
58
|
+
summary: A Ruby-based parser-generator based on Parsing Expression Grammars.
|
59
|
+
test_files: []
|
60
|
+
|