fancy 0.3.3 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (182) hide show
  1. data/README.md +14 -14
  2. data/Rakefile +16 -4
  3. data/bin/fancy +3 -0
  4. data/bin/fspec +20 -0
  5. data/bin/fyi +27 -11
  6. data/bin/ifancy +1 -1
  7. data/boot/fancy_ext.rb +1 -0
  8. data/boot/fancy_ext/block_env.rb +1 -9
  9. data/boot/fancy_ext/delegator.rb +64 -0
  10. data/boot/fancy_ext/object.rb +4 -0
  11. data/boot/fancy_ext/thread.rb +4 -0
  12. data/boot/load.rb +5 -1
  13. data/boot/rbx-compiler/compiler/ast.rb +0 -1
  14. data/boot/rbx-compiler/compiler/ast/class_def.rb +2 -0
  15. data/boot/rbx-compiler/compiler/ast/method_def.rb +2 -0
  16. data/boot/rbx-compiler/compiler/ast/node.rb +10 -0
  17. data/boot/rbx-compiler/compiler/ast/ruby_args.rb +12 -0
  18. data/boot/rbx-compiler/compiler/ast/singleton_method_def.rb +2 -0
  19. data/boot/rbx-compiler/parser/fancy_parser.bundle +0 -0
  20. data/boot/rbx-compiler/parser/lexer.lex +5 -11
  21. data/boot/rbx-compiler/parser/parser.rb +16 -5
  22. data/boot/rbx-compiler/parser/parser.y +39 -24
  23. data/doc/api/fancy.css +1 -1
  24. data/doc/api/fancy.jsonp +1 -1
  25. data/doc/api/fdoc.js +22 -4
  26. data/doc/api/index.html +5 -6
  27. data/doc/api/jquery-ui.min.js +401 -0
  28. data/doc/api/jquery.tools.min.js +192 -0
  29. data/doc/api/themeswitchertool.js +250 -0
  30. data/doc/features.md +17 -0
  31. data/examples/actor_bunnies.fy +32 -0
  32. data/examples/actors.fy +26 -0
  33. data/examples/actors_primitive.fy +27 -0
  34. data/examples/actors_ring.fy +37 -0
  35. data/examples/armstrong_numbers.fy +1 -1
  36. data/examples/array.fy +7 -9
  37. data/examples/async_send.fy +1 -2
  38. data/examples/blocks.fy +4 -4
  39. data/examples/call_with_receiver.fy +1 -1
  40. data/examples/class.fy +1 -1
  41. data/examples/default_args.fy +4 -1
  42. data/examples/define_methods.fy +2 -2
  43. data/examples/echo.fy +1 -1
  44. data/examples/factorial.fy +1 -1
  45. data/examples/future_composition.fy +2 -2
  46. data/examples/futures.fy +0 -5
  47. data/examples/game_of_life.fy +1 -1
  48. data/examples/person.fy +1 -1
  49. data/lib/argv.fy +7 -2
  50. data/lib/array.fy +109 -42
  51. data/lib/block.fy +39 -14
  52. data/lib/boot.fy +2 -0
  53. data/lib/class.fy +2 -0
  54. data/lib/compiler/ast.fy +2 -1
  55. data/lib/compiler/ast/assign.fy +2 -3
  56. data/lib/compiler/ast/async_send.fy +1 -15
  57. data/lib/compiler/ast/class_def.fy +2 -1
  58. data/lib/compiler/ast/expression_list.fy +4 -5
  59. data/lib/compiler/ast/future_send.fy +1 -10
  60. data/lib/compiler/ast/goto.fy +46 -0
  61. data/lib/compiler/ast/identifier.fy +9 -7
  62. data/lib/compiler/ast/literals.fy +8 -1
  63. data/lib/compiler/ast/match.fy +14 -4
  64. data/lib/compiler/ast/message_send.fy +34 -6
  65. data/lib/compiler/ast/method_def.fy +6 -6
  66. data/lib/compiler/ast/node.fy +3 -3
  67. data/lib/compiler/ast/range.fy +1 -0
  68. data/lib/compiler/ast/script.fy +0 -2
  69. data/lib/compiler/ast/singleton_method_def.fy +2 -4
  70. data/lib/compiler/ast/string_interpolation.fy +17 -0
  71. data/lib/compiler/ast/super.fy +5 -4
  72. data/lib/compiler/ast/try_catch.fy +8 -6
  73. data/lib/compiler/ast/tuple_literal.fy +3 -2
  74. data/lib/compiler/command.fy +0 -1
  75. data/lib/compiler/compiler.fy +1 -5
  76. data/lib/compiler/stages.fy +6 -14
  77. data/lib/documentation.fy +57 -46
  78. data/lib/enumerable.fy +257 -23
  79. data/lib/enumerator.fy +122 -15
  80. data/lib/false_class.fy +10 -1
  81. data/lib/fancy_spec.fy +263 -61
  82. data/lib/fdoc.fy +11 -25
  83. data/lib/fiber.fy +11 -0
  84. data/lib/file.fy +8 -11
  85. data/lib/future.fy +84 -5
  86. data/lib/hash.fy +65 -14
  87. data/lib/integer.fy +35 -0
  88. data/lib/iteration.fy +54 -29
  89. data/lib/message.fy +6 -0
  90. data/lib/method.fy +0 -16
  91. data/lib/nil_class.fy +58 -8
  92. data/lib/number.fy +49 -22
  93. data/lib/object.fy +371 -65
  94. data/lib/package.fy +24 -1
  95. data/lib/package/installer.fy +5 -9
  96. data/lib/package/specification.fy +2 -2
  97. data/lib/parser/ext/lexer.lex +15 -11
  98. data/lib/parser/ext/parser.y +70 -23
  99. data/lib/parser/methods.fy +33 -14
  100. data/lib/proxy.fy +33 -3
  101. data/lib/range.fy +28 -0
  102. data/lib/rbx.fy +3 -1
  103. data/lib/rbx/actor.fy +53 -0
  104. data/lib/rbx/alpha.fy +31 -0
  105. data/lib/rbx/array.fy +21 -12
  106. data/lib/rbx/bignum.fy +6 -2
  107. data/lib/rbx/block.fy +23 -26
  108. data/lib/rbx/class.fy +54 -2
  109. data/lib/rbx/code_loader.fy +8 -4
  110. data/lib/rbx/date.fy +9 -0
  111. data/lib/rbx/directory.fy +18 -0
  112. data/lib/rbx/environment_variables.fy +1 -0
  113. data/lib/rbx/exception.fy +9 -2
  114. data/lib/rbx/fiber.fy +22 -4
  115. data/lib/rbx/file.fy +5 -5
  116. data/lib/rbx/fixnum.fy +5 -0
  117. data/lib/rbx/float.fy +11 -3
  118. data/lib/rbx/hash.fy +31 -16
  119. data/lib/rbx/integer.fy +1 -0
  120. data/lib/rbx/io.fy +17 -7
  121. data/lib/rbx/match_data.fy +15 -4
  122. data/lib/rbx/method.fy +40 -7
  123. data/lib/rbx/name_error.fy +4 -0
  124. data/lib/rbx/object.fy +92 -24
  125. data/lib/rbx/range.fy +20 -6
  126. data/lib/rbx/regexp.fy +11 -3
  127. data/lib/rbx/string.fy +51 -1
  128. data/lib/rbx/stringio.fy +17 -0
  129. data/lib/rbx/symbol.fy +15 -1
  130. data/lib/rbx/system.fy +20 -2
  131. data/lib/rbx/tcp_server.fy +4 -1
  132. data/lib/rbx/tcp_socket.fy +11 -0
  133. data/lib/rbx/time.fy +6 -0
  134. data/lib/rbx/tuple.fy +14 -5
  135. data/lib/set.fy +144 -29
  136. data/lib/stack.fy +42 -11
  137. data/lib/string.fy +118 -8
  138. data/lib/struct.fy +13 -3
  139. data/lib/symbol.fy +21 -2
  140. data/lib/thread_pool.fy +2 -1
  141. data/lib/true_class.fy +45 -7
  142. data/lib/tuple.fy +27 -9
  143. data/lib/version.fy +2 -2
  144. data/ruby_lib/fancy +43 -0
  145. data/ruby_lib/fdoc +23 -0
  146. data/ruby_lib/fspec +3 -0
  147. data/ruby_lib/fyi +3 -0
  148. data/ruby_lib/ifancy +3 -0
  149. data/tests/argv.fy +5 -9
  150. data/tests/array.fy +323 -196
  151. data/tests/assignment.fy +29 -29
  152. data/tests/block.fy +72 -59
  153. data/tests/class.fy +227 -138
  154. data/tests/control_flow.fy +83 -51
  155. data/tests/documentation.fy +8 -8
  156. data/tests/enumerable.fy +8 -0
  157. data/tests/enumerator.fy +47 -29
  158. data/tests/exception.fy +49 -32
  159. data/tests/file.fy +28 -28
  160. data/tests/fixnum.fy +170 -0
  161. data/tests/future.fy +24 -7
  162. data/tests/hash.fy +55 -38
  163. data/tests/method.fy +50 -43
  164. data/tests/nil_class.fy +37 -37
  165. data/tests/object.fy +152 -70
  166. data/tests/pattern_matching.fy +67 -31
  167. data/tests/range.fy +6 -6
  168. data/tests/set.fy +101 -4
  169. data/tests/stack.fy +14 -5
  170. data/tests/string.fy +115 -61
  171. data/tests/stringio.fy +18 -0
  172. data/tests/struct.fy +27 -0
  173. data/tests/symbol.fy +19 -6
  174. data/tests/true_class.fy +34 -34
  175. data/tests/tuple.fy +30 -12
  176. metadata +103 -81
  177. data/boot/rbx-compiler/compiler/ast/require.rb +0 -20
  178. data/examples/actor.fy +0 -37
  179. data/examples/curl_async.fy +0 -37
  180. data/lib/compiler/ast/require.fy +0 -15
  181. data/tests/number.fy +0 -135
  182. data/tests/parsing/sexp.fy +0 -50
@@ -1,5 +1,7 @@
1
1
  class FalseClass {
2
- "FalseClass. The class of the singleton @false value."
2
+ """
3
+ FalseClass. The class of the singleton @false value.
4
+ """
3
5
 
4
6
  def FalseClass new {
5
7
  # always return false singleton object when trying to create a new
@@ -35,6 +37,8 @@ class FalseClass {
35
37
  "false"
36
38
  }
37
39
 
40
+ alias_method: 'inspect for: 'to_s
41
+
38
42
  def to_a {
39
43
  "Returns an empty @Array@."
40
44
  []
@@ -50,3 +54,8 @@ class FalseClass {
50
54
  true
51
55
  }
52
56
  }
57
+
58
+ false documentation: """
59
+ @false is the singleton boolean false value (only instance of @FalseClass@).
60
+ FalseClass##new yields @false.
61
+ """
@@ -4,29 +4,77 @@ class FancySpec {
4
4
  Have a look at the tests/ directory to see some examples.
5
5
  """
6
6
 
7
-
8
7
  def initialize: @description test_obj: @test_obj (@description) {
8
+ """
9
+ @description Description @String@ for testcase.
10
+ @test_obj Object to be tested, defaults to @description.
11
+ """
12
+
9
13
  @spec_tests = []
14
+ @before_blocks = []
15
+ @after_blocks = []
10
16
  }
11
17
 
12
18
  def FancySpec describe: test_obj with: block {
19
+ """
20
+ Factory method for creating FancySpec instances.
21
+ Calls @block with the new FancySpec instance as the receiver, then runs it.
22
+
23
+ FancySpec describe: MyTestClass with: {
24
+ # test cases using it:for:when: here.
25
+ }
26
+ """
27
+
13
28
  spec = FancySpec new: test_obj
14
29
  block call_with_receiver: spec
15
30
  spec run
16
31
  }
17
32
 
18
33
  def FancySpec describe: description for: test_obj with: block {
34
+ """
35
+ Similar to FancySpec##describe:with: but also taking an explicit @test_obj.
36
+
37
+ FancySpec describe: \"My cool class\" for: MyCoolClass with: {
38
+ # test cases using it:for:when: here.
39
+ }
40
+ """
41
+
19
42
  spec = FancySpec new: description test_obj: test_obj
20
43
  block call_with_receiver: spec
21
44
  spec run
22
45
  }
23
46
 
24
47
  def it: spec_info_string when: spec_block {
48
+ """
49
+ @spec_info_string Info @String@ related to the test case defined in @spec_block.
50
+ @spec_block @Block@ that holds the testcase's code (including assertions).
51
+
52
+ Example usage:
53
+ it: \"should be an empty Array\" when: {
54
+ arr = [1,2,3]
55
+ 3 times: { arr pop }
56
+ arr empty? is == true
57
+ }
58
+ """
59
+
25
60
  test = SpecTest new: spec_info_string block: spec_block
26
61
  @spec_tests << test
27
62
  }
28
63
 
29
- def it: spec_info_string for: method_name when: spec_block {
64
+ def it: spec_info_string with: method_name when: spec_block {
65
+ """
66
+ @spec_info_string Info @String@ related to the test case defined in @spec_block.
67
+ @method_name Name of Method that this testcase is related to.
68
+ @spec_block @Block@ that holds the testcase's code (including assertions).
69
+
70
+ Example usage:
71
+ it: \"should be an empty Array\" with: 'empty? when: {
72
+ arr = [1,2,3]
73
+ 3 times: { arr pop }
74
+ arr empty? is == true
75
+ }
76
+ """
77
+
30
78
  test = SpecTest new: spec_info_string block: spec_block
31
79
  # try {
32
80
  # @test_obj method: method_name . if_true: |method| {
@@ -38,12 +86,40 @@ class FancySpec {
38
86
  @spec_tests << test
39
87
  }
40
88
 
89
+ alias_method: 'it:for:when: for: 'it:with:when:
90
+
91
+ def before_each: block {
92
+ """
93
+ @block @Block@ to be run before each test case.
94
+ """
95
+
96
+ @before_blocks << block
97
+ }
98
+
99
+ def after_each: block {
100
+ """
101
+ @block @Block@ to be run after each test case.
102
+ """
103
+
104
+ @after_blocks << block
105
+ }
106
+
41
107
  def run {
42
- "Running tests for: " ++ @description ++ ": " print
108
+ """
109
+ Runs a FancySpec's test cases.
110
+ """
111
+
112
+ # " " ++ @description ++ ": " print
43
113
  @spec_tests each: |test| {
114
+ @before_blocks each: |b| {
115
+ b call_with_receiver: test
116
+ }
44
117
  test run: @test_obj
118
+ @after_blocks each: |b| {
119
+ b call_with_receiver: test
120
+ }
45
121
  }
46
- # Console newline Console newline
122
+
47
123
  # untested_methods = @test_obj methods select: |m| {
48
124
  # m tests size == 0
49
125
  # }
@@ -51,63 +127,129 @@ class FancySpec {
51
127
  # ["WARNING: These methods need tests:",
52
128
  # untested_methods map: 'name . select: |m| { m whitespace? not } . join: ", "] println
53
129
  # }
54
- Console newline
55
130
  }
56
131
 
57
132
 
58
133
  class SpecTest {
59
- @@failed_positive = []
60
- @@failed_negative = []
134
+ """
135
+ FancySpec test case class.
136
+ """
137
+
138
+ read_slot: 'info_str
139
+
140
+ @@failed_positive = <[]>
141
+ @@failed_negative = <[]>
142
+ @@failed_count = 0
143
+ @@total_tests = 0
144
+ @@total_expectations = 0
145
+
146
+ def SpecTest add_expectation {
147
+ @@total_expectations = @@total_expectations + 1
148
+ }
61
149
 
62
- def SpecTest failed_test: actual_and_expected {
63
- @@failed_positive << [actual_and_expected, caller(6) at: 0]
150
+ def SpecTest failed_test: test {
151
+ """
152
+ @actual_and_expected Pair of actual and expected values for a failed test case.
153
+
154
+ Gets called when a SpecTest failed.
155
+ """
156
+
157
+ @@failed_positive[@@current_test_obj]: $ @@failed_positive[@@current_test_obj] || { Set new }
158
+ @@failed_positive[@@current_test_obj] << test
159
+ @@failed_count = @@failed_count + 1
160
+ }
161
+
162
+ def SpecTest failed_negative_test: test {
163
+ """
164
+ @value Value that should not have occured.
165
+
166
+ Gets called when a negative SpecTest (using @NegativeMatcher@) failed.
167
+ """
168
+
169
+ @@failed_negative[@@current_test_obj]: $ @@failed_negative[@@current_test_obj] || { Set new }
170
+ @@failed_negative[@@current_test_obj] << test
171
+ @@failed_count = @@failed_count + 1
64
172
  }
65
173
 
66
- def SpecTest failed_negative_test: value {
67
- @@failed_negative << [value, caller(6) at: 0]
174
+ def SpecTest current {
175
+ @@current
176
+ }
177
+
178
+ def SpecTest print_failures {
179
+ @@failed_positive each: |test_obj failed_tests| {
180
+ failed_tests each: |t| {
181
+ Console newline
182
+ "> FAILED: " ++ test_obj ++ " " ++ (t info_str) print
183
+ t print_failed_positive
184
+ }
185
+ }
186
+
187
+ @@failed_negative each: |test_obj failed_tests| {
188
+ failed_tests each: |t| {
189
+ Console newline
190
+ "> FAILED: " ++ test_obj ++ " " ++ (t info_str) print
191
+ t print_failed_negative
192
+ }
193
+ }
194
+
195
+ Console newline
196
+ "Ran #{@@total_tests} tests (#{@@total_expectations} expectations) with #{@@failed_count} failures." println
197
+ if: (@@failed_count > 0) then: {
198
+ System exit: 1
199
+ } else: {
200
+ System exit: 0
201
+ }
68
202
  }
69
203
 
70
204
  def initialize: @info_str block: @block {
71
- { @@failed_positive = [] } unless: @@failed_positive
72
- { @@failed_negative = [] } unless: @@failed_negative
205
+ { @@failed_positive = <[]> } unless: @@failed_positive
206
+ { @@failed_negative = <[]> } unless: @@failed_negative
207
+ @failed_positive = []
208
+ @failed_negative = []
73
209
  }
74
210
 
75
211
  def run: test_obj {
76
- @@failed_positive = []
77
- @@failed_negative = []
212
+ @@current_test_obj = test_obj
213
+ @@current = self
214
+ @@total_tests = @@total_tests + 1
78
215
  try {
79
- @block call
80
- } catch IOError => e {
81
- SpecTest failed_test: [e, "UNKNOWN"]
216
+ @block call_with_receiver: self
217
+ } catch Exception => e {
218
+ failed: (e, "No Exception")
82
219
  }
83
220
 
84
- any_failure = nil
85
- if: (@@failed_positive size > 0) then: {
86
- any_failure = true
87
- Console newline
88
- "> FAILED: " ++ test_obj ++ " " ++ @info_str print
89
- print_failed_positive
221
+ if: failed? then: {
222
+ "f" print
223
+ } else: {
224
+ "." print
90
225
  }
226
+ }
91
227
 
92
- if: (@@failed_negative size > 0) then: {
93
- any_failure = true
94
- Console newline
95
- "> FAILED: " ++ test_obj ++ " " ++ @info_str print
96
- print_failed_negative
97
- }
228
+ def failed: actual_and_expected {
229
+ @failed_positive << (actual_and_expected, caller(5) at: 0)
230
+ SpecTest failed_test: self
231
+ }
232
+
233
+ def failed_negative: value {
234
+ { value = [value, 'negative_failure] } unless: $ value responds_to?: 'at:
235
+ @failed_negative << (value, caller(6) at: 0)
236
+ SpecTest failed_negative_test: self
237
+ }
98
238
 
99
- { "." print } unless: any_failure
239
+ def failed? {
240
+ @failed_positive empty? not || { @failed_negative empty? not }
100
241
  }
101
242
 
243
+
102
244
  def print_failed_positive {
103
- " [" ++ (@@failed_positive size) ++ " unexpected values]" println
104
- print_failed_common: @@failed_positive
245
+ " [" ++ (@failed_positive size) ++ " unexpected values]" println
246
+ print_failed_common: @failed_positive
105
247
  }
106
248
 
107
249
  def print_failed_negative {
108
- " [" ++ (@@failed_negative size) ++ " unexpected values]" println
250
+ " [" ++ (@failed_negative size) ++ " unexpected values]" println
109
251
  "Should not have gotten the following values: " println
110
- print_failed_common: @@failed_negative
252
+ print_failed_common: @failed_negative
111
253
  }
112
254
 
113
255
  def print_failed_common: failures {
@@ -117,75 +259,103 @@ class FancySpec {
117
259
  location = location split: "/" . from: -2 to: -1 . join: "/"
118
260
 
119
261
  location println
120
- " Expected: #{expected inspect}" println
121
- " Received: #{actual inspect}" println
262
+ unless: (expected == 'negative_failure) do: {
263
+ " Expected: #{expected inspect}" println
264
+ " Received: #{actual inspect}" println
265
+ } else: {
266
+ " " ++ (actual inspect) println
267
+ }
122
268
  }
123
269
  }
124
270
  }
125
271
 
126
272
  class PositiveMatcher {
127
- """PositiveMatcher expects its actual value to be equal to an
128
- expected value.
129
- If the values are not equal, a SpecTest failure is generated."""
273
+ """
274
+ PositiveMatcher expects its actual value to be equal to an
275
+ expected value.
276
+ If the values are not equal, a SpecTest failure is generated.
277
+ """
130
278
 
131
279
  def initialize: @actual_value {
280
+ SpecTest add_expectation
132
281
  }
133
282
 
134
283
  def == expected_value {
135
284
  unless: (@actual_value == expected_value) do: {
136
- SpecTest failed_test: [@actual_value, expected_value]
285
+ SpecTest current failed: (@actual_value, expected_value)
137
286
  }
138
287
  }
139
288
 
140
289
  def != expected_value {
141
290
  unless: (@actual_value != expected_value) do: {
142
- SpecTest failed_negative_test: [@actual_value, expected_value]
291
+ SpecTest current failed_negative: (@actual_value, expected_value)
143
292
  }
144
293
  }
145
294
 
146
295
  def raise: exception_class {
147
296
  try {
148
297
  @actual_value call
298
+ # make sure we raise an exception.
299
+ # if no exepction raised at this point, we have an error.
300
+ SpecTest current failed: (nil, exception_class)
149
301
  } catch exception_class {
150
302
  # ok
151
303
  } catch Exception => e {
152
- SpecTest failed_test: [e class, exception_class]
304
+ SpecTest current failed: (e class, exception_class)
305
+ }
306
+ }
307
+
308
+ def raise: exception_class with: block {
309
+ try {
310
+ @actual_value call
311
+ # same here
312
+ SpecTest current failed: (nil, exception_class)
313
+ } catch exception_class => e {
314
+ block call: [e]
315
+ # ok
316
+ } catch Exception => e {
317
+ SpecTest current failed: (e class, exception_class)
153
318
  }
154
319
  }
155
320
 
156
321
  def unknown_message: msg with_params: params {
157
- """Forwardy any other message and parameters to the object itself
158
- and checks the return value."""
322
+ """
323
+ Forwards any other message and parameters to the object itself
324
+ and checks the return value.
325
+ """
159
326
 
160
- unless: (@actual_value send_message: msg with_params: params) do: {
161
- SpecTest failed_test: [@actual_value, params first]
327
+ unless: (@actual_value receive_message: msg with_params: params) do: {
328
+ SpecTest current failed: (@actual_value, params first)
162
329
  }
163
330
  }
164
331
 
165
332
  def be: block {
166
333
  unless: (block call: [@actual_value]) do: {
167
- SpecTest failed_test: [@actual_value, nil]
334
+ SpecTest current failed: (@actual_value, nil)
168
335
  }
169
336
  }
170
337
  }
171
338
 
172
339
  class NegativeMatcher {
173
- """NegativeMatcher expects its actual value to be unequal to an
174
- expected value.
175
- If the values are equal, a SpecTest failure is generated."""
340
+ """
341
+ NegativeMatcher expects its actual value to be unequal to an
342
+ expected value.
343
+ If the values are equal, a SpecTest failure is generated.
344
+ """
176
345
 
177
346
  def initialize: @actual_value {
347
+ SpecTest add_expectation
178
348
  }
179
349
 
180
350
  def == expected_value {
181
351
  if: (@actual_value == expected_value) then: {
182
- SpecTest failed_negative_test: @actual_value
352
+ SpecTest current failed_negative: @actual_value
183
353
  }
184
354
  }
185
355
 
186
356
  def != expected_value {
187
357
  if: (@actual_value != expected_value) then: {
188
- SpecTest failed_test: [@actual_value, expected_value]
358
+ SpecTest current failed: (@actual_value, expected_value)
189
359
  }
190
360
  }
191
361
 
@@ -193,7 +363,7 @@ class FancySpec {
193
363
  try {
194
364
  @actual_value call
195
365
  } catch exception_class {
196
- SpecTest failed_negative_test: [exception_class, nil]
366
+ SpecTest current failed_negative: (exception_class, nil)
197
367
  } catch Exception => e {
198
368
  true
199
369
  # ok
@@ -201,17 +371,19 @@ class FancySpec {
201
371
  }
202
372
 
203
373
  def unknown_message: msg with_params: params {
204
- """Forwardy any other message and parameters to the object itself
205
- and checks the return value."""
374
+ """
375
+ Forwards any other message and parameters to the object itself
376
+ and checks the return value.
377
+ """
206
378
 
207
- if: (@actual_value send_message: msg with_params: params) then: {
208
- SpecTest failed_negative_test: @actual_value
379
+ if: (@actual_value receive_message: msg with_params: params) then: {
380
+ SpecTest current failed_negative: @actual_value
209
381
  }
210
382
  }
211
383
 
212
384
  def be: block {
213
385
  if: (block call: [@actual_value]) then: {
214
- SpecTest failed_negative_test: @actual_value
386
+ SpecTest current failed_negative: @actual_value
215
387
  }
216
388
  }
217
389
  }
@@ -219,12 +391,42 @@ class FancySpec {
219
391
 
220
392
  class Object {
221
393
  def should {
222
- "Returns a PositiveMatcher for self."
394
+ """
395
+ Returns a @PositiveMatcher@ for self.
396
+ """
397
+
223
398
  FancySpec PositiveMatcher new: self
224
399
  }
225
400
 
401
+ alias_method: 'is for: 'should
402
+ alias_method: 'does for: 'should
403
+
404
+ def is: expected {
405
+ is == expected
406
+ }
407
+
408
+ def is_not: expected {
409
+ does_not == expected
410
+ }
411
+
226
412
  def should_not {
227
- "Returns a NegativeMatcher for self."
413
+ """
414
+ Returns a @NegativeMatcher@ for self.
415
+ """
416
+
228
417
  FancySpec NegativeMatcher new: self
229
418
  }
419
+
420
+ alias_method: 'is_not for: 'should_not
421
+ alias_method: 'does_not for: 'should_not
230
422
  }
423
+
424
+ class Block {
425
+ def raises: exception_class {
426
+ FancySpec PositiveMatcher new: self . raise: exception_class
427
+ }
428
+
429
+ def raises: exception_class with: block {
430
+ FancySpec PositiveMatcher new: self . raise: exception_class with: block
431
+ }
432
+ }