Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implementation of dies_ok and lives_ok in Test.pm #108

Closed
p6rt opened this issue May 26, 2008 · 6 comments
Closed

Implementation of dies_ok and lives_ok in Test.pm #108

p6rt opened this issue May 26, 2008 · 6 comments
Labels

Comments

@p6rt
Copy link

p6rt commented May 26, 2008

Migrated from rt.perl.org#54826 (status was 'resolved')

Searchable as RT54826$

@p6rt
Copy link
Author

p6rt commented May 26, 2008

From @bacek

Hello.

There is implementation of dies_ok and lives_ok.

--
Bacek

@p6rt
Copy link
Author

p6rt commented May 26, 2008

From @bacek

dies.diff
diff --git a/languages/perl6/Test.pm b/languages/perl6/Test.pm
index d09234f..52bc15e 100644
--- a/languages/perl6/Test.pm
+++ b/languages/perl6/Test.pm
@@ -102,6 +102,26 @@ multi sub flunk($reason) { proclaim(0, "flunk $reason")}
 
 sub isa_ok($var,$type) { ok($var.isa($type), "The object is-a '$type'"); }
 
+multi sub dies_ok($closure, $reason) {
+    try {
+        $closure();
+    }
+    proclaim((defined $!), $reason);
+}
+multi sub dies_ok($closure) {
+    dies_ok($closure, '');
+}
+multi sub lives_ok($closure, $reason) {
+    try {
+        $closure();
+    }
+    proclaim((not defined $!), $reason);
+}
+multi sub lives_ok($closure) {
+    lives_ok($closure, '');
+}
+
+
 ## 'private' subs
 
 sub proclaim($cond, $desc) {

@p6rt
Copy link
Author

p6rt commented May 26, 2008

From @pmichaud

There is implementation of dies_ok and lives_ok.

Applied in r27825, thanks!

Pm

@p6rt
Copy link
Author

p6rt commented May 26, 2008

The RT System itself - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

p6rt commented May 26, 2008

From @pmichaud

Applied in r27825, thanks!

Pm

@p6rt
Copy link
Author

p6rt commented May 26, 2008

@pmichaud - Status changed from 'open' to 'resolved'

@p6rt p6rt closed this as completed May 26, 2008
@p6rt p6rt added the patch label Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant