opal 0.3.2 → 0.3.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (203) hide show
  1. data/README.md +85 -127
  2. data/bin/opal +3 -3
  3. data/lib/core.rb +114 -0
  4. data/{gems/core/lib → lib}/core/array.rb +68 -187
  5. data/{gems/core/lib → lib}/core/basic_object.rb +22 -5
  6. data/lib/core/class.rb +38 -0
  7. data/{gems/core/lib → lib}/core/dir.rb +1 -1
  8. data/lib/core/enumerable.rb +33 -0
  9. data/{gems/core/lib → lib}/core/error.rb +1 -4
  10. data/{gems/core/lib → lib}/core/false_class.rb +0 -0
  11. data/{gems/core/lib → lib}/core/file.rb +11 -3
  12. data/{gems/core/lib → lib}/core/hash.rb +12 -0
  13. data/{gems/core/lib → lib}/core/kernel.rb +114 -86
  14. data/lib/core/match_data.rb +33 -0
  15. data/lib/core/module.rb +97 -0
  16. data/{gems/core/lib → lib}/core/nil_class.rb +0 -0
  17. data/{gems/core/lib → lib}/core/numeric.rb +5 -0
  18. data/{gems/core/lib → lib}/core/object.rb +0 -0
  19. data/{gems/core/lib → lib}/core/proc.rb +13 -3
  20. data/{gems/core/lib → lib}/core/range.rb +10 -0
  21. data/{gems/core/lib → lib}/core/regexp.rb +33 -1
  22. data/{gems/core/lib → lib}/core/string.rb +25 -10
  23. data/{gems/core/lib → lib}/core/symbol.rb +3 -3
  24. data/{gems/core/lib → lib}/core/top_self.rb +0 -0
  25. data/{gems/core/lib → lib}/core/true_class.rb +0 -0
  26. data/lib/dev.rb +169 -0
  27. data/{gems/ospec/lib → lib}/ospec.rb +1 -0
  28. data/lib/ospec/autorun.rb +8 -0
  29. data/{gems/ospec/lib → lib}/ospec/dsl.rb +2 -2
  30. data/{gems/ospec/lib → lib}/ospec/example.rb +0 -0
  31. data/{gems/ospec/lib → lib}/ospec/example/before_and_after_hooks.rb +0 -0
  32. data/{gems/ospec/lib → lib}/ospec/example/errors.rb +0 -0
  33. data/{gems/ospec/lib → lib}/ospec/example/example_group.rb +0 -0
  34. data/{gems/ospec/lib → lib}/ospec/example/example_group_factory.rb +0 -3
  35. data/{gems/ospec/lib → lib}/ospec/example/example_group_hierarchy.rb +4 -3
  36. data/{gems/ospec/lib → lib}/ospec/example/example_group_methods.rb +1 -1
  37. data/{gems/ospec/lib → lib}/ospec/example/example_group_proxy.rb +3 -2
  38. data/{gems/ospec/lib → lib}/ospec/example/example_methods.rb +1 -1
  39. data/{gems/ospec/lib → lib}/ospec/example/example_proxy.rb +7 -7
  40. data/{gems/ospec/lib → lib}/ospec/expectations.rb +0 -0
  41. data/{gems/ospec/lib → lib}/ospec/expectations/errors.rb +0 -0
  42. data/{gems/ospec/lib → lib}/ospec/expectations/fail_with.rb +4 -3
  43. data/{gems/ospec/lib → lib}/ospec/expectations/handler.rb +6 -0
  44. data/lib/ospec/helpers/scratch.rb +18 -0
  45. data/{gems/ospec/lib → lib}/ospec/matchers.rb +2 -2
  46. data/{gems/ospec/lib → lib}/ospec/matchers/be.rb +0 -0
  47. data/{gems/ospec/lib → lib}/ospec/matchers/generated_descriptions.rb +0 -0
  48. data/{gems/ospec/lib → lib}/ospec/matchers/operator_matcher.rb +2 -0
  49. data/lib/ospec/matchers/raise_error.rb +38 -0
  50. data/lib/ospec/runner.rb +90 -0
  51. data/{gems/ospec/lib → lib}/ospec/runner/example_group_runner.rb +10 -13
  52. data/lib/ospec/runner/formatter/html_formatter.rb +139 -0
  53. data/{gems/ospec/lib → lib}/ospec/runner/formatter/terminal_formatter.rb +0 -0
  54. data/{gems/ospec/lib → lib}/ospec/runner/options.rb +1 -3
  55. data/{gems/ospec/lib → lib}/ospec/runner/reporter.rb +0 -9
  56. data/lib/racc/parser.rb +165 -0
  57. data/lib/strscan.rb +52 -0
  58. data/{lib → opal_lib}/opal.rb +2 -0
  59. data/opal_lib/opal/build_methods.rb +51 -0
  60. data/opal_lib/opal/builder.rb +164 -0
  61. data/opal_lib/opal/bundle.rb +70 -0
  62. data/opal_lib/opal/command.rb +68 -0
  63. data/{lib → opal_lib}/opal/context.rb +21 -9
  64. data/{lib → opal_lib}/opal/context/console.rb +0 -2
  65. data/opal_lib/opal/context/file_system.rb +34 -0
  66. data/{lib → opal_lib}/opal/context/loader.rb +26 -8
  67. data/opal_lib/opal/gem.rb +84 -0
  68. data/{lib → opal_lib}/opal/rake/builder_task.rb +2 -2
  69. data/opal_lib/opal/rake/spec_task.rb +32 -0
  70. data/{lib → opal_lib}/opal/ruby/nodes.rb +730 -109
  71. data/{lib → opal_lib}/opal/ruby/parser.rb +90 -23
  72. data/opal_lib/opal/ruby/ruby_parser.rb +4862 -0
  73. data/opal_lib/opal/ruby/ruby_parser.y +1454 -0
  74. data/opal_lib/opal/version.rb +4 -0
  75. data/runtime/class.js +359 -0
  76. data/runtime/debug.js +84 -0
  77. data/runtime/fs.js +199 -0
  78. data/runtime/init.js +558 -0
  79. data/runtime/loader.js +351 -0
  80. data/runtime/module.js +109 -0
  81. data/runtime/post.js +10 -0
  82. data/runtime/pre.js +7 -0
  83. data/runtime/runtime.js +351 -0
  84. metadata +88 -175
  85. data/.gitignore +0 -7
  86. data/Changelog +0 -31
  87. data/LICENSE +0 -75
  88. data/Rakefile +0 -86
  89. data/gems/core/README.md +0 -14
  90. data/gems/core/Rakefile +0 -8
  91. data/gems/core/core.gemspec +0 -13
  92. data/gems/core/lib/core.rb +0 -34
  93. data/gems/core/lib/core/class.rb +0 -31
  94. data/gems/core/lib/core/module.rb +0 -100
  95. data/gems/core/lib/core/vm.rb +0 -16
  96. data/gems/core/spec/core/array/append_spec.rb +0 -30
  97. data/gems/core/spec/core/array/assoc_spec.rb +0 -29
  98. data/gems/core/spec/core/array/at_spec.rb +0 -37
  99. data/gems/core/spec/core/array/clear_spec.rb +0 -22
  100. data/gems/core/spec/core/array/collect_bang_spec.rb +0 -27
  101. data/gems/core/spec/core/array/collect_spec.rb +0 -27
  102. data/gems/core/spec/core/array/compact_spec.rb +0 -41
  103. data/gems/core/spec/core/array/concat_spec.rb +0 -15
  104. data/gems/core/spec/core/array/constructor_spec.rb +0 -14
  105. data/gems/core/spec/core/array/each_spec.rb +0 -9
  106. data/gems/core/spec/core/array/element_reference_spec.rb +0 -4
  107. data/gems/core/spec/core/array/first_spec.rb +0 -35
  108. data/gems/core/spec/core/array/include_spec.rb +0 -9
  109. data/gems/core/spec/core/array/join_spec.rb +0 -6
  110. data/gems/core/spec/core/array/last_spec.rb +0 -51
  111. data/gems/core/spec/core/array/length_spec.rb +0 -6
  112. data/gems/core/spec/core/array/map_spec.rb +0 -33
  113. data/gems/core/spec/core/array/reverse_spec.rb +0 -6
  114. data/gems/core/spec/core/builtin_constants/builtin_constants_spec.rb +0 -7
  115. data/gems/core/spec/core/false/and_spec.rb +0 -10
  116. data/gems/core/spec/core/false/inspect_spec.rb +0 -6
  117. data/gems/core/spec/core/false/or_spec.rb +0 -10
  118. data/gems/core/spec/core/false/to_s_spec.rb +0 -6
  119. data/gems/core/spec/core/false/xor_spec.rb +0 -10
  120. data/gems/core/spec/core/file/join_spec.rb +0 -19
  121. data/gems/core/spec/core/hash/assoc_spec.rb +0 -32
  122. data/gems/core/spec/core/kernel/instance_eval_spec.rb +0 -0
  123. data/gems/core/spec/core/kernel/loop_spec.rb +0 -24
  124. data/gems/core/spec/core/kernel/raise_spec.rb +0 -0
  125. data/gems/core/spec/core/module/attr_accessor_spec.rb +0 -28
  126. data/gems/core/spec/core/number/lt_spec.rb +0 -12
  127. data/gems/core/spec/core/string/sub_spec.rb +0 -24
  128. data/gems/core/spec/core/true/and_spec.rb +0 -10
  129. data/gems/core/spec/core/true/inspect_spec.rb +0 -6
  130. data/gems/core/spec/core/true/or_spec.rb +0 -10
  131. data/gems/core/spec/core/true/to_s_spec.rb +0 -6
  132. data/gems/core/spec/core/true/xor_spec.rb +0 -10
  133. data/gems/core/spec/language/and_spec.rb +0 -61
  134. data/gems/core/spec/language/array_spec.rb +0 -68
  135. data/gems/core/spec/language/block_spec.rb +0 -38
  136. data/gems/core/spec/language/break_spec.rb +0 -36
  137. data/gems/core/spec/language/case_spec.rb +0 -103
  138. data/gems/core/spec/language/def_spec.rb +0 -21
  139. data/gems/core/spec/language/eigenclass_spec.rb +0 -60
  140. data/gems/core/spec/language/file_spec.rb +0 -13
  141. data/gems/core/spec/language/fixtures/block.rb +0 -21
  142. data/gems/core/spec/language/fixtures/super.rb +0 -293
  143. data/gems/core/spec/language/hash_spec.rb +0 -29
  144. data/gems/core/spec/language/if_spec.rb +0 -54
  145. data/gems/core/spec/language/loop_spec.rb +0 -11
  146. data/gems/core/spec/language/metaclass_spec.rb +0 -21
  147. data/gems/core/spec/language/method_spec.rb +0 -124
  148. data/gems/core/spec/language/next_spec.rb +0 -25
  149. data/gems/core/spec/language/or_spec.rb +0 -34
  150. data/gems/core/spec/language/redo_spec.rb +0 -24
  151. data/gems/core/spec/language/regexp_spec.rb +0 -26
  152. data/gems/core/spec/language/rescue_spec.rb +0 -20
  153. data/gems/core/spec/language/return_spec.rb +0 -47
  154. data/gems/core/spec/language/string_spec.rb +0 -25
  155. data/gems/core/spec/language/super_spec.rb +0 -32
  156. data/gems/core/spec/language/until_spec.rb +0 -157
  157. data/gems/core/spec/language/variables_spec.rb +0 -155
  158. data/gems/core/spec/language/while_spec.rb +0 -163
  159. data/gems/core/spec/spec_helper.rb +0 -5
  160. data/gems/core_fs/README.md +0 -19
  161. data/gems/dev/Rakefile +0 -5
  162. data/gems/dev/lib/dev.js +0 -99
  163. data/gems/dev/lib/dev/generator.js +0 -1264
  164. data/gems/dev/lib/dev/parser.js +0 -979
  165. data/gems/dev/lib/dev/ruby_parser.js +0 -1088
  166. data/gems/dev/lib/dev/ruby_parser.y +0 -1267
  167. data/gems/dev/lib/dev/string_scanner.js +0 -38
  168. data/gems/dev/tools/racc2js/README.md +0 -39
  169. data/gems/dev/tools/racc2js/math_parser.js +0 -222
  170. data/gems/dev/tools/racc2js/math_parser.rb +0 -133
  171. data/gems/dev/tools/racc2js/math_parser.y +0 -28
  172. data/gems/dev/tools/racc2js/parser.js +0 -218
  173. data/gems/dev/tools/racc2js/racc2js.rb +0 -153
  174. data/gems/json/README.md +0 -4
  175. data/gems/json/json.gemspec +0 -14
  176. data/gems/json/lib/json.rb +0 -64
  177. data/gems/json/lib/json/ext.rb +0 -51
  178. data/gems/json/lib/json/json2.js +0 -481
  179. data/gems/ospec/README.md +0 -0
  180. data/gems/ospec/lib/ospec/autorun.rb +0 -3
  181. data/gems/ospec/lib/ospec/runner.rb +0 -40
  182. data/gems/ospec/lib/ospec/runner/formatter/html_formatter.rb +0 -91
  183. data/gems/ospec/ospec.gemspec +0 -0
  184. data/gems/rquery/README.md +0 -9
  185. data/gems/rquery/lib/rquery.rb +0 -10
  186. data/gems/rquery/lib/rquery/ajax.rb +0 -4
  187. data/gems/rquery/lib/rquery/css.rb +0 -96
  188. data/gems/rquery/lib/rquery/document.rb +0 -25
  189. data/gems/rquery/lib/rquery/element.rb +0 -292
  190. data/gems/rquery/lib/rquery/event.rb +0 -108
  191. data/gems/rquery/lib/rquery/jquery.js +0 -8177
  192. data/gems/rquery/lib/rquery/request.rb +0 -138
  193. data/gems/rquery/lib/rquery/response.rb +0 -49
  194. data/gems/rquery/rquery.gemspec +0 -16
  195. data/lib/opal.js +0 -1597
  196. data/lib/opal/builder.rb +0 -117
  197. data/lib/opal/bundle.rb +0 -131
  198. data/lib/opal/command.rb +0 -11
  199. data/lib/opal/context/file_system.rb +0 -19
  200. data/lib/opal/gem.rb +0 -153
  201. data/lib/opal/ruby/ruby_parser.rb +0 -5170
  202. data/lib/opal/ruby/ruby_parser.y +0 -1298
  203. data/opal.gemspec +0 -15
@@ -1,11 +0,0 @@
1
-
2
- describe "The loop expression" do
3
- it "repeats the given block until a break is called" do
4
- outer_loop = 0
5
- loop do
6
- outer_loop = outer_loop + 1
7
- break if outer_loop == 10
8
- end
9
- outer_loop.should == 10
10
- end
11
- end
@@ -1,21 +0,0 @@
1
- #
2
- # describe "self in a metaclass body (class << obj)" do
3
- # it "is TrueClass for true" do
4
- # class << true; self; end.should == TrueClass
5
- # end
6
- #
7
- # it "is FalseClass for false" do
8
- # class << false; self; end.should == FalseClass
9
- # end
10
- #
11
- # it "is NilClass for nil" do
12
- # class << nil; self; end.should == NilClass
13
- # end
14
- #
15
- # it "raises a TypeError for numbers"
16
- #
17
- # it "raises a TypeError for symbols"
18
- #
19
- # it "is a singleton Class instance"
20
- #
21
- # end
@@ -1,124 +0,0 @@
1
-
2
- describe "Calling a method" do
3
- it "with no arguments is ok" do
4
- def fooP0; 100; end
5
-
6
- fooP0.should == 100
7
- end
8
-
9
- it "with simple required arguments works" do
10
- def fooP1(a); [a]; end
11
- fooP1(1).should == [1]
12
-
13
- def fooP2(a, b); [a, b]; end
14
- fooP2(1, 2).should == [1, 2]
15
-
16
- def fooP3(a,b,c); [a,b,c]; end
17
- fooP3(1,2,3).should == [1,2,3]
18
-
19
- def fooP4(a,b,c,d); [a,b,c,d]; end
20
- fooP4(1,2,3,4).should == [1,2,3,4]
21
-
22
- def fooP5(a,b,c,d,e); [a,b,c,d,e]; end
23
- fooP5(1,2,3,4,5).should == [1,2,3,4,5]
24
- end
25
-
26
- it "works with optional arguments" do
27
- def fooP0O1(a=1); [a]; end
28
- fooP0O1().should == [1]
29
-
30
- def fooP1O1(a, b=1); [a, b]; end
31
- fooP1O1(1).should == [1, 1]
32
-
33
- def fooP2O1(a, b, c=1); [a, b, c]; end
34
- fooP2O1(1, 2).should == [1, 2, 1]
35
-
36
- def fooP3O1(a, b, c, d=1); [a, b, c, d]; end
37
- fooP3O1(1, 2, 3).should == [1, 2, 3, 1]
38
-
39
- def fooP4O1(a, b, c, d, e=1); [a, b, c, d, e]; end
40
- fooP4O1(1, 2, 3, 4).should == [1, 2, 3, 4, 1]
41
-
42
- def fooP0O2(a=1, b=2); [a, b]; end
43
- fooP0O2.should == [1, 2]
44
- end
45
-
46
- it "works with rest arguments" do
47
- def fooP0R(*r); r; end
48
- fooP0R().should == []
49
- fooP0R(1).should == [1]
50
- fooP0R(1, 2).should == [1, 2]
51
-
52
- def fooP1R(a, *r); [a, r]; end
53
- fooP1R(1).should == [1, []]
54
- fooP1R(1, 2).should == [1, [2]]
55
-
56
- # def fooP0O1R(a=1, *r); [a, r]; end
57
- # fooP0O1R().should == [1, []]
58
- end
59
-
60
- it "with an empty expression is like calling with nil argument" do
61
- def foo(a); a; end
62
- foo(()).should == nil
63
- end
64
-
65
- it "with block as block argument is ok" do
66
- def foo(a, &b); [a, yield(b)] end
67
-
68
- foo(10) do 200 end.should == [10, 200]
69
- foo(10) { 200 }.should == [10, 200]
70
- end
71
-
72
- it "with block argument converts the block to proc" do
73
- def makeproc(&b) b end
74
- makeproc { "hello" }.call.should == "hello"
75
- makeproc { "hello" }.class.should == Proc
76
-
77
- def proc_caller(&b) b.call end
78
- def enclosing_method
79
- proc_caller { return :break_return_value }
80
- :method_return_value
81
- end
82
-
83
- enclosing_method.should == :break_return_value
84
- end
85
-
86
- it "with same names as existing variables is ok" do
87
- foobar = 100
88
-
89
- def foobar; 200; end
90
-
91
- foobar.should == 100
92
- foobar().should == 200
93
- end
94
-
95
- it "with splat operator * and literal array unpacks params" do
96
- def fooP3(a, b, c); [a, b, c]; end
97
-
98
- fooP3(*[1, 2, 3]).should == [1, 2, 3]
99
- end
100
-
101
- it "with splat operator * and references array unpacks params" do
102
- def fooP3(a,b,c); [a,b,c] end
103
-
104
- a = [1,2,3]
105
- fooP3(*a).should == [1,2,3]
106
- end
107
-
108
- it "without parentheses works" do
109
- def fooP3(a,b,c); [a,b,c] end
110
-
111
- (fooP3 1,2,3).should == [1,2,3]
112
- end
113
-
114
- it "with a space separating method name and parenthesis treats expression in parenthesis as first argument" do
115
- def myfoo(x); x * 2 end
116
- def mybar
117
- # means myfoo((5).to_s)
118
- # NOT (myfoo(5)).to_s
119
- # myfoo (5).to_s
120
- end
121
-
122
- # mybar().should == "55"
123
- end
124
- end
@@ -1,25 +0,0 @@
1
-
2
- describe "The next statement from within the block" do
3
- it "ends block execution" do
4
- a = []
5
- lambda {
6
- a << 1
7
- next
8
- a << 2
9
- }.call
10
- a.should == [1]
11
- end
12
-
13
- it "causes block to return nil if invoked without arguments" do
14
- lambda { 123; next; 456 }.call.should == nil
15
- end
16
-
17
- it "causes block to return nil if invoked with an empty expression" do
18
- lambda { next (); 456 }.call.should == nil
19
- end
20
-
21
- it "returns the argument passed" do
22
- lambda { 123; next 234; 345 }.call.should == 234
23
- end
24
- end
25
-
@@ -1,34 +0,0 @@
1
-
2
- describe "The || operator" do
3
- it "evaluates to true if any of its operands are true" do
4
- if false || true || nil
5
- x = true
6
- end
7
- x.should == true
8
- end
9
-
10
- it "evaluates to false if all of its operands are false" do
11
- if false || nil
12
- x = true
13
- end
14
- x.should == nil
15
- end
16
-
17
- it "is evaluated before assignment operators" do
18
- x = nil || true
19
- x.should == true
20
- end
21
-
22
- it "has a lower precedence than the && operator" do
23
- x = 1 || false && x = 2
24
- x.should == 1
25
- end
26
-
27
- it "treats empty expressions as nil" do
28
- (() || true).should == true
29
- (() || false).should == false
30
- (true || ()).should == true
31
- (false || ()).should == nil
32
- (() || ()).should == nil
33
- end
34
- end
@@ -1,24 +0,0 @@
1
-
2
- describe "The redo statement" do
3
- it "restarts block execution if used within block" do
4
- a = []
5
- lambda {
6
- a << 1
7
- redo if a.size < 2
8
- a << 2
9
- }.call
10
- a.should == [1, 1, 2]
11
- end
12
-
13
- it "re-executes the closest loop"
14
-
15
- it "re-executes the last step in enumeration" do
16
- list = []
17
- [1,2,3].each do |x|
18
- list << x
19
- break if list.size == 6
20
- redo if x == 3
21
- end
22
- list.should == [1,2,3,3,3,3]
23
- end
24
- end
@@ -1,26 +0,0 @@
1
-
2
- describe "Regexp literals" do
3
-
4
- # ===========================================================================
5
- # = Back-refs =
6
- # ===========================================================================
7
-
8
- it "saves match data in the $~ pseudo-global variable" do
9
- "hello" =~ /l+/
10
- $~.to_a.should == ["ll"]
11
- end
12
-
13
- it "saves captures in numbered $[1-9] variables" do
14
- "1234567890" =~ /(1)(2)(3)(4)(5)(6)(7)(8)(9)(0)/
15
- $~.to_a.should == ["1234567890", "1", "2", "3", "4", "5", "6", "7", "8", "9", "0"]
16
- $1.should == "1"
17
- $2.should == "2"
18
- $3.should == "3"
19
- $4.should == "4"
20
- $5.should == "5"
21
- $6.should == "6"
22
- $7.should == "7"
23
- $8.should == "8"
24
- $9.should == "9"
25
- end
26
- end
@@ -1,20 +0,0 @@
1
-
2
- class SpecificExampleException < StandardError; end
3
-
4
- class OtherCustomException < StandardError; end
5
-
6
- def exception_list
7
- [SpecificExampleException, OtherCustomException]
8
- end
9
-
10
- describe "The rescue keyword" do
11
- it "can be used to handle a specific exception"
12
-
13
- it "can capture the raised exception in a local variable" do
14
- begin
15
- raise SpecificExampleException, "some text"
16
- rescue SpecificExampleException => e
17
- e.message.should == "some text"
18
- end
19
- end
20
- end
@@ -1,47 +0,0 @@
1
-
2
- describe "The return keyword" do
3
- it "returns any object directly" do
4
- def r; return 1; end
5
- r().should == 1
6
- end
7
-
8
- it "returns an single element array directly" do
9
- def r; return[1]; end
10
- r().should == [1]
11
- end
12
-
13
- it "returns an multi element array directly" do
14
- def r; return [1, 2]; end
15
- r().should == [1, 2]
16
- end
17
-
18
- it "returns nil be default" do
19
- def r; return; end
20
- r().should == nil
21
- end
22
-
23
- # describe "within a begin" do
24
- # it "executes ensure before re"
25
- # end
26
-
27
- describe "within a block" do
28
- it "raises a LocalJumpError if there is no lexicaly enclosing method" #do
29
- # def f; yield; end
30
- # lambda { f { return 5 } }
31
- # end
32
-
33
- it "causes lambda to return nil if invoked without any arguments" do
34
- lambda { return; 456 }.call.should == nil
35
- end
36
-
37
- end
38
-
39
- describe "within two blocks" do
40
- it "causes the method that lexically encloses the block to return" do
41
- def f
42
- 1.times { 1.times { return true }; false }; false
43
- end
44
- f.should == true
45
- end
46
- end
47
- end
@@ -1,25 +0,0 @@
1
-
2
- describe "Ruby character strings" do
3
- it "don't get interpolated when put in single quotes" do
4
- @ip = 'xxx'
5
- '#{@ip}'.should == '#{@ip}'
6
- end
7
-
8
- it 'get interpolated with #{} when put in double quotes' do
9
- @ip = 'xxx'
10
- "#{@ip}".should == "xxx"
11
- end
12
-
13
- it "interpolate instance variables just with the # character" #do
14
- # @ip = "xxx"
15
- # "#@ip".should == "xxx"
16
- # end
17
-
18
- it "interpolate global variables just with the # character"
19
-
20
- it "interpolate class variables with just the # character"
21
-
22
- it "allow underscore as part of a variable name in a simple interpolation"
23
-
24
- it "have characters [.(=?!# end simple # interpolation"
25
- end
@@ -1,32 +0,0 @@
1
- require File.expand_path('../../spec_helper', __FILE__)
2
- require File.expand_path('../fixtures/super', __FILE__)
3
-
4
- describe "The super keyword" do
5
-
6
- it "calls the method on the calling class" do
7
- Super::S1::A.new.foo([]).should == ["A#foo", "A#bar"]
8
- Super::S1::A.new.bar([]).should == ["A#bar"]
9
- Super::S1::B.new.foo([]).should == ["B#foo","A#foo","B#bar","A#bar"]
10
- Super::S1::B.new.bar([]).should == ["B#bar", "A#bar"]
11
- end
12
-
13
- it "searches the full inheritence chain" do
14
- Super::S2::B.new.foo([]).should == ["B#foo", "A#baz"]
15
- Super::S2::B.new.baz([]).should == ["A#baz"]
16
- Super::S2::C.new.foo([]).should == ["B#foo","C#baz","A#baz"]
17
- Super::S2::C.new.baz([]).should == ["C#baz","A#baz"]
18
- end
19
-
20
- it "searches class methods" do
21
- Super::S3::A.new.foo([]).should == ["A#foo"]
22
- Super::S3::A.foo([]).should == ["A::foo"]
23
- Super::S3::A.bar([]).should == ["A::bar","A::foo"]
24
- Super::S3::B.new.foo([]).should == ["A#foo"]
25
- Super::S3::B.foo([]).should == ["B::foo","A::foo"]
26
- Super::S3::B.bar([]).should == ["B::bar","A::bar","B::foo","A::foo"]
27
- end
28
-
29
- it "calls the method on the calling class including modules" do
30
- Super::MS1::A.new.foo([]).should == ["ModA#foo", "ModA#bar"]
31
- end
32
- end
@@ -1,157 +0,0 @@
1
-
2
- describe "The until expression" do
3
- it "runs while the expression is false" do
4
- i = 0
5
- until i > 9
6
- i = i + 1
7
- end
8
-
9
- i.should == 10
10
- end
11
-
12
- it "optionally takes a 'do' after the expression" do
13
- i = 0
14
- until i > 9 do
15
- i = i + 1
16
- end
17
-
18
- i.should == 10
19
- end
20
-
21
- it "allows body begin on the same line if do is used" do
22
- i = 0
23
- until i > 9 do i = i + 1
24
- end
25
-
26
- i.should == 10
27
- end
28
-
29
- it "executes code in containing variable scope" do
30
- i = 0
31
- until i == 1
32
- a = 123
33
- i = 1
34
- end
35
-
36
- a.should == 123
37
- end
38
-
39
- it "executes code in containing variable scope with 'do'" do
40
- i = 0
41
- until i == 1 do
42
- a = 123
43
- i = 1
44
- end
45
-
46
- a.should == 123
47
- end
48
-
49
- it "returns nil if ended when condition became true" do
50
- i = 0
51
- until i > 9
52
- i = i + 1
53
- end.should == nil
54
- end
55
-
56
- it "evaluates the body if expression is empty" do
57
- a = []
58
- until ()
59
- a << :body_evaluated
60
- break
61
- end
62
- a.should == [:body_evaluated]
63
- end
64
-
65
- it "stops running body if interrupted by break" do
66
- i = 0
67
- until i > 9
68
- i = i + 1
69
- break if i > 5
70
- end
71
- i.should == 6
72
- end
73
-
74
- it "returns value passed to break if interrupted by break" do
75
- until false
76
- break 123
77
- end.should == 123
78
- end
79
-
80
- it "returns nil if interrupted by break with no arguments" do
81
- until false
82
- break
83
- end.should == nil
84
- end
85
-
86
- it "skips to end of body with next" do
87
- a = []
88
- i = 0
89
- until (i = i + 1) >= 5
90
- next if i == 3
91
- a << i
92
- end
93
-
94
- a.should == [1, 2, 4]
95
- end
96
-
97
- it "restarts the current iteration without reevaluating condition with redo" do
98
- a = []
99
- i = 0
100
- j = 0
101
- until (i = i + 1) >= 3
102
- a << i
103
- j = j + 1
104
- redo if j < 3
105
- end
106
- a.should == [1, 1, 1, 2]
107
- end
108
- end
109
-
110
- # describe "The until modifier" do
111
- # it "runs preceding statement while the condition is false" do
112
- # i = 0
113
- # i = i + 1 until i > 9
114
- # i.should == 10
115
- # end
116
- #
117
- # it "evaluates condition before statement execution" do
118
- # a = []
119
- # i = 0
120
- # a << i until (i = i + 1) >= 3
121
- # a.should == [1, 2]
122
- # end
123
- #
124
- # it "does not run preceding statement if the condition is true" do
125
- # i = 0
126
- # i = i + 1 until true
127
- # i.should == 0
128
- # end
129
- #
130
- # it "returns nil if ended when condition became true" do
131
- # i = 0
132
- # (i = i + 1 until i > 9).should == nil
133
- # end
134
- #
135
- # it "returns value passed to break if interrupted by break" do
136
- # (break 123 until false).should == 123
137
- # end
138
- #
139
- # it "returns nil if interrupted by break with no arguments" do
140
- # (break until false).should == nil
141
- # end
142
- #
143
- # it "skips to end of body with next" do
144
- # i = 0
145
- # j = 0
146
- # (i = i + 1) == 3 ? next : j = j + i until i > 10
147
- # j.should == 63
148
- # end
149
- #
150
- # it "restarts the current iteration without reevaluating condition with redo" do
151
- # i = 0
152
- # j = 0
153
- # (i = i + 1) == 4 ? redo : j = j + i until (i = i + 1) > 10
154
- # j.should == 34
155
- # end
156
- # end
157
-