Permalink
Browse files

Merge branch 'master' of git@github.com:rakudo/rakudo

  • Loading branch information...
2 parents 30e0ed3 + ac581a1 commit 100bb1641fe8aa98cc2a3ce3985e8e5f06636bcc @chromatic chromatic committed Feb 14, 2010
Showing with 16,285 additions and 3,014 deletions.
  1. +5 −4 .gitignore
  2. +3 −3 README
  3. +68 −90 Test.pm
  4. +241 −149 build/Makefile.in
  5. +1 −1 build/PARROT_REVISION
  6. +18 −0 build/gen_cheats_pir.pl
  7. +32 −0 build/gen_core_pm.pl
  8. +0 −43 build/gen_setting_pm.pl
  9. +5 −5 docs/ROADMAP
  10. +132 −127 docs/compiler_overview.pod
  11. +331 −0 docs/metamodel.pod
  12. +1 −0 lib/Safe.pm
  13. +2,250 −0 src/Perl6/Actions.pm
  14. +159 −0 src/Perl6/Compiler.pir
  15. +23 −0 src/Perl6/Compiler/Module.pm
  16. +184 −0 src/Perl6/Compiler/Package.pm
  17. +131 −0 src/Perl6/Compiler/Parameter.pm
  18. +175 −0 src/Perl6/Compiler/Role.pm
  19. +154 −139 src/{parser/signature.pm → Perl6/Compiler/Signature.pm}
  20. +1,231 −0 src/Perl6/Grammar.pm
  21. +110 −51 src/binder/bind.c
  22. +18 −16 src/binder/bind.h
  23. +41 −0 src/builtins/Abstraction.pir
  24. +2 −2 src/{classes → builtins}/Any.pir
  25. +102 −0 src/builtins/Array.pir
  26. +130 −0 src/builtins/Associative.pir
  27. +1 −1 src/{classes → builtins}/Block.pir
  28. +4 −10 src/{classes → builtins}/Bool.pir
  29. +17 −6 src/{classes → builtins}/Callable.pir
  30. +124 −0 src/builtins/Capture.pir
  31. +216 −0 src/builtins/Code.pir
  32. +45 −0 src/builtins/ContainerDeclarand.pir
  33. +31 −0 src/builtins/EMPTY.pir
  34. +41 −0 src/builtins/Enum.pir
  35. +116 −0 src/builtins/Exception.pir
  36. +123 −0 src/builtins/Failure.pir
  37. +10 −7 src/{classes → builtins}/Grammar.pir
  38. +28 −24 src/{classes → builtins}/Int.pir
  39. +47 −0 src/builtins/Iterable.pir
  40. +88 −0 src/builtins/Iterator.pir
  41. +506 −0 src/builtins/Junction.pir
  42. +102 −0 src/builtins/List.pir
  43. +1 −1 src/{classes → builtins}/Method.pir
  44. +549 −0 src/builtins/Mu.pir
  45. +42 −0 src/builtins/Multi.pir
  46. +27 −9 src/{classes → builtins}/Num.pir
  47. +29 −0 src/builtins/Pair.pir
  48. +268 −0 src/builtins/Parcel.pir
  49. +82 −0 src/builtins/ParrotIter.pir
  50. +57 −49 src/{classes → builtins}/Positional.pir
  51. +80 −0 src/builtins/Proxy.pir
  52. +39 −0 src/builtins/Regex.pir
  53. +18 −14 src/{classes → builtins}/Role.pir
  54. +1 −1 src/{classes → builtins}/Routine.pir
  55. +196 −0 src/builtins/Seq.pir
  56. +63 −0 src/builtins/SeqIter.pir
  57. +131 −0 src/builtins/Signature.pir
  58. +20 −73 src/{classes → builtins}/Str.pir
  59. +1 −1 src/{classes → builtins}/Sub.pir
  60. +29 −0 src/builtins/Submethod.pir
  61. +34 −332 src/builtins/assign.pir
  62. +118 −550 src/builtins/control.pir
  63. +75 −0 src/cheats/any-map.pir
  64. +58 −0 src/cheats/autoincrement.pir
  65. +22 −0 src/cheats/callmethod.pir
  66. +16 −0 src/cheats/constants.pir
  67. +35 −0 src/cheats/eval.pm
  68. +19 −0 src/cheats/fail.pir
  69. +79 −0 src/cheats/gatheriterator.pir
  70. +27 −0 src/cheats/import.pir
  71. +17 −0 src/cheats/int-ops.pir
  72. +63 −0 src/cheats/mapiterator.pir
  73. +5 −0 src/cheats/match-bool.pm
  74. +7 −0 src/cheats/misc.txt
  75. +36 −0 src/cheats/num-ops.pir
  76. +25 −0 src/cheats/num.pm
  77. +25 −0 src/cheats/object.pir
  78. +9 −0 src/cheats/only_infix_redispatcher.pir
  79. +28 −0 src/cheats/parrot-role-quirks.pir
  80. +24 −43 src/{ → cheats}/parrot/P6role.pir
  81. +0 −54 src/{ → cheats}/parrot/Protoobject.pir
  82. +24 −0 src/cheats/parrot/attriter.pir
  83. +41 −0 src/cheats/parrot/register.pir
  84. +27 −0 src/cheats/perl6-compiler.pir
  85. +160 −0 src/cheats/relops.pir
  86. +32 −0 src/cheats/setup-io.pm
  87. +27 −0 src/cheats/str-ops.pir
  88. +50 −0 src/cheats/trait-export.pm
  89. +28 −0 src/cheats/use.pir
  90. +40 −0 src/cheats/want-caller-side-callsig.pir
  91. +0 −505 src/classes/ClassHOW.pir
  92. +0 −29 src/classes/RoleHOW.pir
  93. +162 −0 src/core/Any-list.pm
  94. +429 −0 src/core/Any-num.pm
  95. +240 −0 src/core/Any-str.pm
  96. +34 −0 src/core/Array.pm
  97. +33 −0 src/core/Block.pm
  98. +3 −0 src/core/Bool.pm
  99. +345 −0 src/core/Complex.pm
  100. +67 −0 src/core/Enum.pm
  101. +67 −0 src/core/EnumMap.pm
  102. +54 −0 src/core/Hash.pm
  103. +127 −0 src/core/IO.pm
  104. +76 −0 src/core/Int.pm
  105. +5 −0 src/core/Iterable.pm
  106. +35 −0 src/core/Iterator.pm
  107. +19 −0 src/core/Mu.pm
  108. +166 −0 src/core/Num.pm
  109. +6 −0 src/core/Pair.pm
  110. +29 −0 src/core/Parameter.pm
  111. +5 −0 src/core/Parcel.pm
  112. +95 −0 src/core/Range.pm
  113. +25 −0 src/core/RangeIter.pm
  114. +128 −0 src/core/Rat.pm
  115. +15 −0 src/core/Seq.pm
  116. +80 −0 src/core/Signature.pm
  117. +7 −0 src/core/Str.pm
  118. +5 −0 src/core/Whatever.pm
  119. +242 −0 src/core/operators.pm
  120. +25 −0 src/core/system.pm
  121. +26 −0 src/core/traits.pm
  122. +2 −0 src/gen/README
  123. +22 −0 src/glue/contextuals.pir
  124. +255 −0 src/glue/dispatch.pir
  125. +82 −0 src/glue/phasers.pir
  126. +109 −0 src/glue/role.pir
  127. +25 −0 src/glue/run.pir
  128. +78 −0 src/glue/types.pir
  129. +71 −0 src/metamodel/Attribute.nqp
  130. +826 −0 src/metamodel/ClassHOW.pir
  131. +55 −0 src/metamodel/GrammarHOW.pir
  132. +350 −0 src/metamodel/RoleHOW.pir
  133. +102 −0 src/metamodel/RoleToClassApplier.nqp
  134. +47 −0 src/metamodel/RoleToInstanceApplier.nqp
  135. +136 −0 src/metamodel/RoleToRoleApplier.nqp
  136. 0 src/{builtins → old/builtins-old}/any-list.pir
  137. 0 src/{builtins → old/builtins-old}/any-num.pir
  138. 0 src/{builtins → old/builtins-old}/any-str.pir
  139. +364 −0 src/old/builtins-old/assign.pir
  140. 0 src/{builtins → old/builtins-old}/cmp.pir
  141. 0 src/{builtins → old/builtins-old}/compiler.pir
  142. +605 −0 src/old/builtins-old/control.pir
  143. 0 src/{builtins → old/builtins-old}/eval.pir
  144. 0 src/{builtins → old/builtins-old}/globals.pir
  145. +0 −45 src/{builtins → old/builtins-old}/guts.pir
  146. 0 src/{builtins → old/builtins-old}/io.pir
  147. 0 src/{builtins → old/builtins-old}/match.pir
  148. 0 src/{builtins → old/builtins-old}/math.pir
  149. 0 src/{builtins → old/builtins-old}/named-unary.pir
  150. 0 src/{builtins → old/builtins-old}/op.pir
  151. 0 src/{builtins → old/builtins-old}/system.pir
  152. 0 src/{ → old}/classes/Abstraction.pir
  153. 0 src/{ → old}/classes/Array.pir
  154. 0 src/{ → old}/classes/Associative.pir
  155. 0 src/{ → old}/classes/AttributeDeclarand.pir
  156. 0 src/{ → old}/classes/Capture.pir
  157. 0 src/{ → old}/classes/Code.pir
  158. 0 src/{ → old}/classes/ContainerDeclarand.pir
  159. 0 src/{ → old}/classes/Exception.pir
  160. 0 src/{ → old}/classes/Failure.pir
  161. 0 src/{ → old}/classes/Hash.pir
  162. 0 src/{ → old}/classes/IO.pir
  163. 0 src/{ → old}/classes/Iterator.pir
  164. 0 src/{ → old}/classes/Junction.pir
  165. 0 src/{ → old}/classes/List.pir
  166. 0 src/{ → old}/classes/Mapping.pir
  167. 0 src/{ → old}/classes/Match.pir
  168. 0 src/{ → old}/classes/Module.pir
  169. 0 src/{ → old}/classes/Multi.pir
  170. 0 src/{ → old}/classes/Nil.pir
  171. 0 src/{ → old}/classes/Object.pir
  172. 0 src/{ → old}/classes/Order.pir
  173. 0 src/{ → old}/classes/Pair.pir
  174. 0 src/{ → old}/classes/Range.pir
  175. 0 src/{ → old}/classes/Regex.pir
  176. +37 −0 src/old/classes/Routine.pir
  177. 0 src/{ → old}/classes/Signature.pir
  178. 0 src/{ → old}/classes/Submethod.pir
  179. 0 src/{ → old}/classes/Whatever.pir
  180. 0 src/{ → old}/classes/WhateverCode.pir
  181. 0 src/{ → old}/parrot/P6Invocation.pir
  182. 0 src/{ → old}/parrot/misc.pir
  183. 0 src/{ → old}/parrot/signature.pir
  184. 0 src/{ → old}/parrot/state.pir
  185. 0 src/{ → old}/parser/actions.pm
  186. 0 src/{ → old}/parser/expression.pir
  187. 0 src/{ → old}/parser/grammar-oper.pg
  188. 0 src/{ → old}/parser/grammar.pg
  189. 0 src/{ → old}/parser/methods.pir
  190. 0 src/{ → old}/parser/quote_expression.pir
  191. 0 src/{ → old}/setting/Any-list.pm
  192. 0 src/{ → old}/setting/Any-num.pm
  193. 0 src/{ → old}/setting/Any-str.pm
  194. 0 src/{ → old}/setting/Array.pm
  195. 0 src/{ → old}/setting/Attribute.pm
  196. 0 src/{ → old}/setting/Block.pm
  197. 0 src/{ → old}/setting/Bool.pm
  198. 0 src/{ → old}/setting/Buf.pm
  199. 0 src/{ → old}/setting/Code.pm
  200. 0 src/{ → old}/setting/Complex.pm
  201. 0 src/{ → old}/setting/Hash.pm
  202. 0 src/{ → old}/setting/IO.pm
  203. 0 src/{ → old}/setting/IO/Socket.pm
  204. 0 src/{ → old}/setting/IO/Socket/INET.pm
  205. 0 src/{ → old}/setting/Int.pm
  206. 0 src/{ → old}/setting/Junction.pm
  207. 0 src/{ → old}/setting/List.pm
  208. 0 src/{ → old}/setting/Mapping.pm
  209. 0 src/{ → old}/setting/Match.pm
  210. 0 src/{ → old}/setting/NYI.pm
  211. 0 src/{ → old}/setting/Num.pm
  212. 0 src/{ → old}/setting/Object.pm
  213. 0 src/{ → old}/setting/Operators.pm
  214. 0 src/{ → old}/setting/Pair.pm
  215. 0 src/{ → old}/setting/Parameter.pm
  216. 0 src/{ → old}/setting/Range.pm
  217. 0 src/{ → old}/setting/Rat.pm
  218. 0 src/{ → old}/setting/Signature.pm
  219. 0 src/{ → old}/setting/Str.pm
  220. 0 src/{ → old}/setting/Temporal.pm
  221. 0 src/{ → old}/setting/Whatever.pm
  222. +0 −47 src/{ → old}/setting/traits.pm
  223. +28 −5 src/ops/perl6.ops
  224. +6 −4 src/pmc/objectref_pmc.template
  225. +17 −0 src/pmc/p6invocation.pmc
  226. +18 −12 src/pmc/p6opaque.pmc
  227. +8 −2 src/pmc/p6role.pmc
  228. +65 −21 src/pmc/perl6multisub.pmc
  229. +3 −3 t/00-parrot/01-literals.t
  230. +0 −27 t/00-parrot/05-var-array.t
  231. +11 −12 t/00-parrot/06-op-inplace.t
  232. +27 −0 t/00-parrot/08-var-array.t
  233. +4 −9 t/00-parrot/09-pir.t
  234. 0 t/00-parrot/{08-regex.t → 10-regex.t}
  235. +10 −0 t/01-sanity/06-eqv.t
  236. +0 −24 t/01-sanity/06-use.t
  237. +0 −15 t/01-sanity/07-binding.t
  238. +0 −24 t/01-sanity/07-for.t
  239. +2 −2 t/01-sanity/07-isa.t
  240. +0 −11 t/01-sanity/07-range.t
  241. +0 −19 t/01-sanity/07-ref.t
  242. +0 −12 t/01-sanity/07-split.t
  243. +0 −13 t/01-sanity/07-substr.t
  244. 0 t/01-sanity/{07-simple-multisubs.t → 08-simple-multisubs.t}
  245. +3 −3 t/01-sanity/{07-end-blocks.t → 09-end-blocks.t}
  246. +0 −30 t/01-sanity/09-types.t
  247. 0 t/01-sanity/{08-say.t → 10-say.t}
  248. 0 t/01-sanity/{07-defined.t → 11-defined.t}
  249. 0 t/01-sanity/{07-try.t → 12-try.t}
  250. +79 −0 t/01-sanity/99-test-basic.t
  251. +2 −3 t/harness
  252. +359 −327 t/spectest.data
  253. +1 −1 tools/benchmark.pl
  254. +77 −0 tools/rakudo-swarm.config
  255. +19 −4 tools/test_summary.pl
View
@@ -1,6 +1,6 @@
*~
-src/gen_*.pir
-src/gen_*.pm
+/src/gen/*
+/nqp-rx/
Makefile
.*.swp
*.patch
@@ -19,8 +19,8 @@ perl6.pdb
perl6.rc
t/localtest.data
t/spec
-parrot
-parrot_install
+/parrot
+/parrot_install
perl6
perl6.c
perl6.o
@@ -34,3 +34,4 @@ perl6_group.?
libparrot.dll
src/binder/bind.bundle
src/binder/bind.o
+docs/test_summary.times
View
6 README
@@ -88,9 +88,9 @@ Once built, Rakudo's C<make install> target will install Rakudo
and its libraries into the Parrot installation that was used to
create it. Until this step is performed, the "perl6" executable
created by C<make> above can only be reliably run from the root of
-Rakudo's build directory. After C<make install> is performed
-the executable can be run from any directory (as long as the
-Parrot installation that was used to create it remains intact).
+Rakudo's build directory. After C<make install> is performed,
+the installed executable can be run from any directory (as long as
+the Parrot installation that was used to create it remains intact).
If the Rakudo compiler is invoked without an explicit script to
run, it enters a small interactive mode that allows Perl 6 statements
View
158 Test.pm
@@ -14,8 +14,6 @@ our $num_of_tests_planned;
our $no_plan = 1;
our $die_on_fail;
-our $GLOBAL::WARNINGS = 0;
-
## If done_testing hasn't been run when we hit our END block, we need to know
## so that it can be run. This allows compatibility with old tests that use
## plans and don't call done_testing.
@@ -31,36 +29,43 @@ sub die_on_fail($fail=1) {
# "plan 'no_plan';" is now "plan *;"
# It is also the default if nobody calls plan at all
-multi sub plan(Whatever $plan) is export(:DEFAULT) {
- $no_plan = 1;
-}
+# multi sub plan(Whatever $plan) is export {
+# $no_plan = 1;
+# }
-multi sub plan($number_of_tests) is export(:DEFAULT) {
- $num_of_tests_planned = $number_of_tests;
- $no_plan = 0;
+multi sub plan($number_of_tests) is export {
+ if $number_of_tests ~~ ::Whatever {
+ $no_plan = 1;
+ }
+ else {
+ $num_of_tests_planned = $number_of_tests;
+ $no_plan = 0;
- say '1..' ~ $number_of_tests;
+ say '1..' ~ $number_of_tests;
+ }
+# say '# t=' ~ time;
}
-multi sub pass($desc) is export(:DEFAULT) {
+multi sub pass($desc) is export {
proclaim(1, $desc);
}
-multi sub ok(Object $cond, $desc) is export(:DEFAULT) {
+multi sub ok(Mu $cond, $desc) is export {
proclaim(?$cond, $desc);
}
-multi sub ok(Object $cond) is export(:DEFAULT) { ok(?$cond, ''); }
+multi sub ok(Mu $cond) is export { ok(?$cond, ''); }
-multi sub nok(Object $cond, $desc) is export(:DEFAULT) {
+multi sub nok(Mu $cond, $desc) is export {
proclaim(!$cond, $desc);
}
-multi sub nok(Object $cond) is export(:DEFAULT) { nok($cond, ''); }
+multi sub nok(Mu $cond) is export { nok($cond, ''); }
-multi sub is(Object $got, Object $expected, $desc) is export(:DEFAULT) {
+multi sub is(Mu $got, Mu $expected, $desc) is export {
+ $got.defined; # Hack to deal with Failures
my $test = $got eq $expected;
proclaim(?$test, $desc);
if !$test {
@@ -73,106 +78,107 @@ multi sub is(Object $got, Object $expected, $desc) is export(:DEFAULT) {
}
}
-multi sub is(Object $got, Object $expected) is export(:DEFAULT) { is($got, $expected, ''); }
+multi sub is(Mu $got, Mu $expected) is export { is($got, $expected, ''); }
-multi sub isnt(Object $got, Object $expected, $desc) is export(:DEFAULT) {
+multi sub isnt(Mu $got, Mu $expected, $desc) is export {
my $test = !($got eq $expected);
proclaim($test, $desc);
}
-multi sub isnt(Object $got, Object $expected) is export(:DEFAULT) { isnt($got, $expected, ''); }
+multi sub isnt(Mu $got, Mu $expected) is export { isnt($got, $expected, ''); }
-multi sub is_approx(Object $got, Object $expected, $desc) is export(:DEFAULT) {
- my $test = ($got - $expected).abs <= 0.00001;
+multi sub is_approx(Mu $got, Mu $expected, $desc) is export {
+ my $test = ($got - $expected).abs <= 1/100000;
proclaim(?$test, $desc);
}
-multi sub is_approx(Object $got, Object $expected) is export(:DEFAULT) {
+multi sub is_approx(Mu $got, Mu $expected) is export {
is_approx($got, $expected, '');
}
-multi sub todo($reason, $count) is export(:DEFAULT) {
+multi sub todo($reason, $count) is export {
$todo_upto_test_num = $num_of_tests_run + $count;
$todo_reason = '# TODO ' ~ $reason;
}
-multi sub todo($reason) is export(:DEFAULT) {
+multi sub todo($reason) is export {
$todo_upto_test_num = $num_of_tests_run + 1;
$todo_reason = '# TODO ' ~ $reason;
}
-multi sub skip() is export(:DEFAULT) { proclaim(1, "# SKIP"); }
-multi sub skip($reason) is export(:DEFAULT) { proclaim(1, "# SKIP " ~ $reason); }
-multi sub skip($count, $reason) is export(:DEFAULT) {
- for 1..$count {
- proclaim(1, "# SKIP " ~ $reason);
- }
+multi sub skip() is export { proclaim(1, "# SKIP"); }
+multi sub skip($reason) is export { proclaim(1, "# SKIP " ~ $reason); }
+multi sub skip($count, $reason) is export {
+ my $i = 1;
+ while $i <= $count { proclaim(1, "# SKIP " ~ $reason); $i = $i + 1; }
}
-multi sub skip_rest() is export(:DEFAULT) {
+multi sub skip_rest() is export {
skip($num_of_tests_planned - $num_of_tests_run, "");
}
-multi sub skip_rest($reason) is export(:DEFAULT) {
+multi sub skip_rest($reason) is export {
skip($num_of_tests_planned - $num_of_tests_run, $reason);
}
-sub diag($message) is export(:DEFAULT) { say '# '~$message; }
+sub diag($message) is export { say '# '~$message; }
-multi sub flunk($reason) is export(:DEFAULT) { proclaim(0, "flunk $reason")}
+multi sub flunk($reason) is export { proclaim(0, "flunk $reason")}
-multi sub isa_ok(Object $var,$type) is export(:DEFAULT) {
+multi sub isa_ok(Mu $var,$type) is export {
ok($var.isa($type), "The object is-a '$type'");
}
-multi sub isa_ok(Object $var,$type, $msg) is export(:DEFAULT) { ok($var.isa($type), $msg); }
+multi sub isa_ok(Mu $var,$type, $msg) is export { ok($var.isa($type), $msg); }
-multi sub dies_ok(Callable $closure, $reason) is export(:DEFAULT) {
+multi sub dies_ok($closure, $reason) is export {
try {
$closure();
}
- if "$!" ~~ / ^ 'Null PMC access ' / {
- diag "wrong way to die: '$!'";
- }
- proclaim((defined $! && "$!" !~~ / ^ 'Null PMC access ' /), $reason);
+ #if "$!" ~~ / ^ 'Null PMC access ' / {
+ # diag "wrong way to die: '$!'";
+ #}
+ proclaim(defined($!), $reason);
+ #proclaim((defined $! && "$!" !~~ / ^ 'Null PMC access ' /), $reason);
}
-multi sub dies_ok(Callable $closure) is export(:DEFAULT) {
+multi sub dies_ok($closure) is export {
dies_ok($closure, '');
}
-multi sub lives_ok(Callable $closure, $reason) is export(:DEFAULT) {
+multi sub lives_ok($closure, $reason) is export {
try {
$closure();
}
proclaim((not defined $!), $reason);
}
-multi sub lives_ok(Callable $closure) is export(:DEFAULT) {
+multi sub lives_ok($closure) is export {
lives_ok($closure, '');
}
-multi sub eval_dies_ok(Str $code, $reason) is export(:DEFAULT) {
+multi sub eval_dies_ok(Str $code, $reason) is export {
my $ee = eval_exception($code);
- if "$ee" ~~ / ^ 'Null PMC access ' / {
- diag "wrong way to die: '$ee'";
- }
- proclaim((defined $ee && "$ee" !~~ / ^ 'Null PMC access' /), $reason);
+ #if "$ee" ~~ / ^ 'Null PMC access ' / {
+ # diag "wrong way to die: '$ee'";
+ #}
+ proclaim((defined $ee), $reason);
+ # proclaim((defined $ee && "$ee" !~~ / ^ 'Null PMC access' /), $reason);
}
-multi sub eval_dies_ok(Str $code) is export(:DEFAULT) {
+multi sub eval_dies_ok(Str $code) is export {
eval_dies_ok($code, '');
}
-multi sub eval_lives_ok(Str $code, $reason) is export(:DEFAULT) {
+multi sub eval_lives_ok(Str $code, $reason) is export {
proclaim((not defined eval_exception($code)), $reason);
}
-multi sub eval_lives_ok(Str $code) is export(:DEFAULT) {
+multi sub eval_lives_ok(Str $code) is export {
eval_lives_ok($code, '');
}
-multi sub is_deeply(Object $got, Object $expected, $reason = '')
- is export(:DEFAULT)
+multi sub is_deeply(Mu $got, Mu $expected, $reason = '')
+ is export
{
my $test = _is_deeply( $got, $expected );
proclaim($test, $reason);
@@ -186,38 +192,8 @@ multi sub is_deeply(Object $got, Object $expected, $reason = '')
}
}
-sub _is_deeply(Object $got, Object $expected) {
-
- if $got ~~ List && $expected ~~ List {
- return if +$got.values != +$expected.values;
- for $got Z $expected -> $a, $b {
- return if ! _is_deeply( $a, $b );
- }
- return True;
- }
- elsif $got ~~ Hash && $expected ~~ Hash {
- return if +$got.keys != +$expected.keys;
- for $got.keys.sort Z $expected.keys.sort -> $a, $b {
- return if $a ne $b;
- return if ! _is_deeply( $got{$a}, $expected{$b} );
- }
- return True;
- }
- elsif $got ~~ Str | Num | Int && $expected ~~ Str | Num | Int {
- return $got eq $expected;
- }
- elsif $got ~~ Pair && $expected ~~ Pair {
- return $got.key eq $expected.key
- && _is_deeply( $got.value, $expected.value );
- }
- elsif $got ~~ undef && $expected ~~ undef && $got.WHAT eq $expected.WHAT {
- return True;
- }
- elsif $got ~~ Bool && $expected ~~ Bool {
- return ($got && $expected) || (!$got && !$expected);
- }
-
- return;
+sub _is_deeply(Mu $got, Mu $expected) {
+ $got eqv $expected;
}
@@ -234,24 +210,26 @@ sub proclaim($cond, $desc) {
unless $cond {
print "not ";
- $num_of_tests_failed = $num_of_tests_failed + 1
- unless $num_of_tests_run <= $todo_upto_test_num;
+ unless $num_of_tests_run <= $todo_upto_test_num {
+ $num_of_tests_failed = $num_of_tests_failed + 1
+ }
}
print "ok ", $num_of_tests_run, " - ", $desc;
if $todo_reason and $num_of_tests_run <= $todo_upto_test_num {
print $todo_reason;
}
print "\n";
+# say '# t=' ~ time;
if !$cond && $die_on_fail && !$todo_reason {
die "Test failed. Stopping test";
}
# must clear this between tests
- $todo_reason = '' if $todo_upto_test_num == $num_of_tests_run;
- return $cond;
+ if $todo_upto_test_num == $num_of_tests_run { $todo_reason = '' }
+ $cond;
}
-sub done_testing() is export(:DEFAULT) {
+sub done_testing() is export {
our $done_testing_has_been_run;
$done_testing_has_been_run = 1;
Oops, something went wrong.

0 comments on commit 100bb16

Please sign in to comment.