Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

[gsoc_spectest] added tests for stub subroutines in S06 (added 9 tests)

git-svn-id: http://svn.pugscode.org/pugs@21889 c213334d-75ef-0310-aa23-eaa082d1ae64
  • Loading branch information...
commit f5a237f8b3f5366b48cabe43c1870f5ad71883ad 1 parent 7959619
Auzon authored
Showing with 36 additions and 0 deletions.
  1. +36 −0 S06-advanced_subroutine_features/stub.t
View
36 S06-advanced_subroutine_features/stub.t
@@ -0,0 +1,36 @@
+use v6;
+use Test;
+
+plan 9;
+
+# L<S06/Stub declarations>
+
+lives_ok({sub thunder {...}}, 'sub foo {...} works');
+
+{
+ sub lightning {...}
+ # Maybe should be warns_ok
+ eval_dies_ok('lightning()', 'executing stub subroutine dies');
+ sub lightning {42}
+ is(lightning(), 42, 'redefining stub subroutine works without extra syntax');
+
+ sub hail {???}
+ # Should be warns_ok
+ lives_ok({hail()}, 'executing stub subroutine lives (should warn here)');
+ sub hail {47}
+ is(hail(), 47, 'redefining stub subroutine works without extra syntax');
+
+ sub wind {!!!}
+ eval_dies_ok('wind()', 'executing stub subroutine dies');
+ sub wind {17}
+ is(wind(), 17, 'redefining stub subroutine works without extra syntax');
+
+}
+
+{
+ sub hail {26}
+ # Maybe should be warns_ok
+ eval_dies_ok('sub hail {10}', 'redefining existing subroutine dies');
+ sub hail is instead {8}
+ is(hail(), 8, 'redefining non-stub subroutine with is instead');
+}
Please sign in to comment.
Something went wrong with that request. Please try again.