rubyjs 0.7.1 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- data/examples/client_server/README +18 -0
- data/examples/client_server/Rakefile +5 -0
- data/examples/client_server/client.js +749 -0
- data/examples/client_server/client.rb +12 -0
- data/examples/client_server/index.html +7 -0
- data/examples/client_server/server.rb +17 -0
- data/examples/hw/hw.js +234 -216
- data/rubyjs.gemspec +2 -2
- data/src/rubyjs.rb +0 -1
- data/src/rubyjs/compiler.rb +21 -8
- data/src/rubyjs/debug_name_generator.rb +23 -6
- data/src/rubyjs/model.rb +14 -8
- data/test/browser.test.html +1 -1
- data/test/browser.test.js +2337 -1992
- data/test/test_yield.rb +2 -0
- metadata +108 -158
- data/patches/parse_tree.rb.diff +0 -34
- data/vendor/ParseTree-1.7.1-patched/History.txt +0 -217
- data/vendor/ParseTree-1.7.1-patched/Manifest.txt +0 -22
- data/vendor/ParseTree-1.7.1-patched/README.txt +0 -110
- data/vendor/ParseTree-1.7.1-patched/Rakefile +0 -41
- data/vendor/ParseTree-1.7.1-patched/bin/parse_tree_abc +0 -89
- data/vendor/ParseTree-1.7.1-patched/bin/parse_tree_audit +0 -28
- data/vendor/ParseTree-1.7.1-patched/bin/parse_tree_deps +0 -62
- data/vendor/ParseTree-1.7.1-patched/bin/parse_tree_show +0 -49
- data/vendor/ParseTree-1.7.1-patched/demo/printer.rb +0 -20
- data/vendor/ParseTree-1.7.1-patched/lib/composite_sexp_processor.rb +0 -49
- data/vendor/ParseTree-1.7.1-patched/lib/parse_tree.rb +0 -1013
- data/vendor/ParseTree-1.7.1-patched/lib/sexp.rb +0 -235
- data/vendor/ParseTree-1.7.1-patched/lib/sexp_processor.rb +0 -330
- data/vendor/ParseTree-1.7.1-patched/lib/unique.rb +0 -15
- data/vendor/ParseTree-1.7.1-patched/test/pt_testcase.rb +0 -1221
- data/vendor/ParseTree-1.7.1-patched/test/something.rb +0 -53
- data/vendor/ParseTree-1.7.1-patched/test/test_all.rb +0 -13
- data/vendor/ParseTree-1.7.1-patched/test/test_composite_sexp_processor.rb +0 -69
- data/vendor/ParseTree-1.7.1-patched/test/test_parse_tree.rb +0 -216
- data/vendor/ParseTree-1.7.1-patched/test/test_sexp.rb +0 -291
- data/vendor/ParseTree-1.7.1-patched/test/test_sexp_processor.rb +0 -244
- data/vendor/ParseTree-1.7.1-patched/validate.sh +0 -31
- data/vendor/ParseTree-1.7.1/History.txt +0 -217
- data/vendor/ParseTree-1.7.1/Manifest.txt +0 -22
- data/vendor/ParseTree-1.7.1/README.txt +0 -110
- data/vendor/ParseTree-1.7.1/Rakefile +0 -41
- data/vendor/ParseTree-1.7.1/bin/parse_tree_abc +0 -89
- data/vendor/ParseTree-1.7.1/bin/parse_tree_audit +0 -28
- data/vendor/ParseTree-1.7.1/bin/parse_tree_deps +0 -62
- data/vendor/ParseTree-1.7.1/bin/parse_tree_show +0 -49
- data/vendor/ParseTree-1.7.1/demo/printer.rb +0 -20
- data/vendor/ParseTree-1.7.1/lib/composite_sexp_processor.rb +0 -49
- data/vendor/ParseTree-1.7.1/lib/parse_tree.rb +0 -1004
- data/vendor/ParseTree-1.7.1/lib/sexp.rb +0 -235
- data/vendor/ParseTree-1.7.1/lib/sexp_processor.rb +0 -330
- data/vendor/ParseTree-1.7.1/lib/unique.rb +0 -15
- data/vendor/ParseTree-1.7.1/test/pt_testcase.rb +0 -1221
- data/vendor/ParseTree-1.7.1/test/something.rb +0 -53
- data/vendor/ParseTree-1.7.1/test/test_all.rb +0 -13
- data/vendor/ParseTree-1.7.1/test/test_composite_sexp_processor.rb +0 -69
- data/vendor/ParseTree-1.7.1/test/test_parse_tree.rb +0 -216
- data/vendor/ParseTree-1.7.1/test/test_sexp.rb +0 -291
- data/vendor/ParseTree-1.7.1/test/test_sexp_processor.rb +0 -244
- data/vendor/ParseTree-1.7.1/validate.sh +0 -31
@@ -1,244 +0,0 @@
|
|
1
|
-
#!/usr/local/bin/ruby -w
|
2
|
-
|
3
|
-
$TESTING = true
|
4
|
-
|
5
|
-
require 'sexp_processor'
|
6
|
-
require 'stringio'
|
7
|
-
require 'test/unit'
|
8
|
-
require 'pp'
|
9
|
-
|
10
|
-
# Fake test classes:
|
11
|
-
|
12
|
-
class TestProcessor < SexpProcessor # ZenTest SKIP
|
13
|
-
attr_accessor :auto_shift_type
|
14
|
-
|
15
|
-
def process_acc1(exp)
|
16
|
-
out = self.expected.new(:acc2, exp.thing_three, exp.thing_two, exp.thing_one)
|
17
|
-
exp.clear
|
18
|
-
return out
|
19
|
-
end
|
20
|
-
|
21
|
-
def process_acc2(exp)
|
22
|
-
out = []
|
23
|
-
out << exp.thing_one
|
24
|
-
end
|
25
|
-
|
26
|
-
def process_specific(exp)
|
27
|
-
result = exp[1..-1]
|
28
|
-
exp.clear
|
29
|
-
self.expected.new(*result)
|
30
|
-
end
|
31
|
-
|
32
|
-
def process_strip(exp)
|
33
|
-
result = exp.deep_clone
|
34
|
-
exp.clear
|
35
|
-
result
|
36
|
-
end
|
37
|
-
|
38
|
-
def process_nonempty(exp)
|
39
|
-
s(*exp)
|
40
|
-
end
|
41
|
-
|
42
|
-
def process_broken(exp)
|
43
|
-
result = [*exp]
|
44
|
-
exp.clear
|
45
|
-
result
|
46
|
-
end
|
47
|
-
|
48
|
-
def process_expected(exp)
|
49
|
-
exp.clear
|
50
|
-
return {}
|
51
|
-
end
|
52
|
-
|
53
|
-
def process_string(exp)
|
54
|
-
return exp.shift
|
55
|
-
end
|
56
|
-
|
57
|
-
def rewrite_rewritable(exp) # (a b c) => (a c b)
|
58
|
-
return s(exp.shift, exp.pop, exp.shift)
|
59
|
-
end
|
60
|
-
|
61
|
-
def process_rewritable(exp)
|
62
|
-
return s(exp.shift, exp.shift == 2, exp.shift == 1)
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
|
-
class TestProcessorDefault < SexpProcessor # ZenTest SKIP
|
67
|
-
def initialize
|
68
|
-
super
|
69
|
-
self.default_method = :def_method
|
70
|
-
end
|
71
|
-
|
72
|
-
def def_method(exp)
|
73
|
-
exp.clear
|
74
|
-
self.expected.new(42)
|
75
|
-
end
|
76
|
-
end
|
77
|
-
|
78
|
-
# Real test classes:
|
79
|
-
|
80
|
-
class TestSexpProcessor < Test::Unit::TestCase
|
81
|
-
|
82
|
-
def setup
|
83
|
-
@processor = TestProcessor.new
|
84
|
-
end
|
85
|
-
|
86
|
-
def test_process_specific
|
87
|
-
a = [:specific, 1, 2, 3]
|
88
|
-
expected = a[1..-1]
|
89
|
-
assert_equal(expected, @processor.process(a))
|
90
|
-
end
|
91
|
-
|
92
|
-
def test_process_general
|
93
|
-
a = [:blah, 1, 2, 3]
|
94
|
-
expected = a.deep_clone
|
95
|
-
assert_equal(expected, @processor.process(a))
|
96
|
-
end
|
97
|
-
|
98
|
-
def test_process_default
|
99
|
-
@processor = TestProcessorDefault.new
|
100
|
-
@processor.warn_on_default = false
|
101
|
-
|
102
|
-
a = s(:blah, 1, 2, 3)
|
103
|
-
assert_equal(@processor.expected.new(42), @processor.process(a))
|
104
|
-
end
|
105
|
-
|
106
|
-
def test_process_not_sexp
|
107
|
-
@processor = TestProcessor.new
|
108
|
-
@processor.warn_on_default = false
|
109
|
-
|
110
|
-
assert_raises(SexpTypeError) do
|
111
|
-
@processor.process([:broken, 1, 2, 3])
|
112
|
-
end
|
113
|
-
end
|
114
|
-
|
115
|
-
def test_process_unsupported_wrong
|
116
|
-
@processor = TestProcessor.new
|
117
|
-
@processor.unsupported << :strip
|
118
|
-
|
119
|
-
assert_raises(UnsupportedNodeError) do
|
120
|
-
@processor.process([:whatever])
|
121
|
-
end
|
122
|
-
end
|
123
|
-
|
124
|
-
def test_unsupported_equal
|
125
|
-
@processor.strict = true
|
126
|
-
@processor.unsupported = [ :unsupported ]
|
127
|
-
assert_raises(UnsupportedNodeError) do
|
128
|
-
@processor.process([:unsupported, 42])
|
129
|
-
end
|
130
|
-
end
|
131
|
-
|
132
|
-
def test_strict
|
133
|
-
@processor.strict = true
|
134
|
-
assert_raise(UnknownNodeError) do
|
135
|
-
@processor.process([:blah, 1, 2, 3])
|
136
|
-
end
|
137
|
-
end
|
138
|
-
def test_strict=; end #Handled
|
139
|
-
|
140
|
-
def test_require_empty_false
|
141
|
-
@processor.require_empty = false
|
142
|
-
|
143
|
-
assert_nothing_raised do
|
144
|
-
@processor.process([:nonempty, 1, 2, 3])
|
145
|
-
end
|
146
|
-
end
|
147
|
-
|
148
|
-
def test_require_empty_true
|
149
|
-
assert_raise(NotEmptyError) do
|
150
|
-
@processor.process([:nonempty, 1, 2, 3])
|
151
|
-
end
|
152
|
-
end
|
153
|
-
def test_require_empty=; end # handled
|
154
|
-
|
155
|
-
def test_process_strip
|
156
|
-
@processor.auto_shift_type = true
|
157
|
-
assert_equal([1, 2, 3], @processor.process(s(:strip, 1, 2, 3)))
|
158
|
-
end
|
159
|
-
|
160
|
-
def test_rewrite
|
161
|
-
assert_equal(s(:rewritable, :b, :a),
|
162
|
-
@processor.rewrite(s(:rewritable, :a, :b)))
|
163
|
-
end
|
164
|
-
|
165
|
-
def test_rewrite_deep
|
166
|
-
assert_equal(s(:specific, s(:rewritable, :b, :a)),
|
167
|
-
@processor.rewrite(s(:specific, s(:rewritable, :a, :b))))
|
168
|
-
end
|
169
|
-
|
170
|
-
def test_process_rewrite
|
171
|
-
assert_equal(s(:rewritable, true, true),
|
172
|
-
@processor.process(s(:rewritable, 1, 2)))
|
173
|
-
end
|
174
|
-
|
175
|
-
def test_process_rewrite_deep
|
176
|
-
assert_equal(s(s(:rewritable, :b, :a)),
|
177
|
-
@processor.process(s(:specific, s(:rewritable, :a, :b))))
|
178
|
-
end
|
179
|
-
|
180
|
-
def test_process_rewrite_not_empty
|
181
|
-
assert_raise(NotEmptyError) do
|
182
|
-
@processor.process(s(:rewritable, 1, 2, 2))
|
183
|
-
end
|
184
|
-
end
|
185
|
-
|
186
|
-
def test_assert_type_hit
|
187
|
-
assert_nothing_raised do
|
188
|
-
@processor.assert_type([:blah, 1, 2, 3], :blah)
|
189
|
-
end
|
190
|
-
end
|
191
|
-
|
192
|
-
def test_assert_type_miss
|
193
|
-
assert_raise(SexpTypeError) do
|
194
|
-
@processor.assert_type([:thingy, 1, 2, 3], :blah)
|
195
|
-
end
|
196
|
-
end
|
197
|
-
|
198
|
-
def test_generate
|
199
|
-
# nothing to test at this time... soon.
|
200
|
-
end
|
201
|
-
|
202
|
-
def test_auto_shift_type
|
203
|
-
@processor.auto_shift_type = false
|
204
|
-
assert_equal(false, @processor.auto_shift_type)
|
205
|
-
@processor.auto_shift_type = true
|
206
|
-
assert_equal(true, @processor.auto_shift_type)
|
207
|
-
end
|
208
|
-
def test_auto_shift_type_equal; end # handled
|
209
|
-
|
210
|
-
def test_default_method
|
211
|
-
# default functionality tested in process_default
|
212
|
-
assert_nil @processor.default_method
|
213
|
-
@processor.default_method = :something
|
214
|
-
assert_equal :something, @processor.default_method
|
215
|
-
end
|
216
|
-
def test_default_method=; end # handled
|
217
|
-
|
218
|
-
def test_expected
|
219
|
-
assert_equal Sexp, @processor.expected
|
220
|
-
assert_raises(SexpTypeError) do
|
221
|
-
@processor.process([:expected]) # should raise
|
222
|
-
end
|
223
|
-
|
224
|
-
@processor.process(s(:str, "string")) # shouldn't raise
|
225
|
-
|
226
|
-
@processor.expected = Hash
|
227
|
-
assert_equal Hash, @processor.expected
|
228
|
-
assert !(Hash === s()), "Hash === s() should not be true"
|
229
|
-
|
230
|
-
assert_raises(SexpTypeError) do
|
231
|
-
@processor.process(s(:string, "string")) # should raise
|
232
|
-
end
|
233
|
-
|
234
|
-
@processor.process([:expected]) # shouldn't raise
|
235
|
-
end
|
236
|
-
def test_expected=; end # handled
|
237
|
-
|
238
|
-
# Not Testing:
|
239
|
-
def test_debug; end
|
240
|
-
def test_debug=; end
|
241
|
-
def test_warn_on_default; end
|
242
|
-
def test_warn_on_default=; end
|
243
|
-
|
244
|
-
end
|
@@ -1,31 +0,0 @@
|
|
1
|
-
#!/bin/bash
|
2
|
-
|
3
|
-
# set -xv
|
4
|
-
|
5
|
-
trap "exit 1" 1 2 3 15
|
6
|
-
|
7
|
-
DIRS="-I../../metaruby/dev/tests/builtin -I../../metaruby/dev/tests -Ilib"
|
8
|
-
for d in $(ls -d ../../*/dev); do
|
9
|
-
DIRS="-I$d $DIRS"
|
10
|
-
done
|
11
|
-
|
12
|
-
if [ -f rb.bad.txt ]; then
|
13
|
-
mv rb.bad.txt rb.files.txt
|
14
|
-
else
|
15
|
-
find ../../*/dev /usr/local/lib/ruby/1.8/ -name \*.rb > rb.files.txt
|
16
|
-
fi
|
17
|
-
|
18
|
-
total_count=$(wc -l rb.files.txt | awk '{print $1}')
|
19
|
-
curr_count=0
|
20
|
-
for f in $(cat rb.files.txt); do
|
21
|
-
curr_count=$(($curr_count + 1))
|
22
|
-
if GEM_SKIP=ParseTree ruby $DIRS ./bin/parse_tree_show -q $f > /dev/null 2> rb.err.txt < /dev/null; then
|
23
|
-
echo $f >> rb.good.txt
|
24
|
-
status=pass
|
25
|
-
else
|
26
|
-
echo $f >> rb.bad.txt
|
27
|
-
status=fail
|
28
|
-
fi
|
29
|
-
fname=`basename $f`
|
30
|
-
printf "%4d/%4d: %s %s\n" $curr_count $total_count $status $fname
|
31
|
-
done
|