[Bps-public-commit] r9002 - in Carp-REPL: . t/scripts
sartak at bestpractical.com
sartak at bestpractical.com
Tue Sep 11 20:12:38 EDT 2007
Author: sartak
Date: Tue Sep 11 20:12:36 2007
New Revision: 9002
Added:
Carp-REPL/t/12-env.t
Carp-REPL/t/scripts/12-env.pl (contents, props changed)
Modified:
Carp-REPL/ (props changed)
Carp-REPL/MANIFEST
Carp-REPL/META.yml
Log:
r42557 at onn: sartak | 2007-09-11 20:05:29 -0400
Add tests for :e
Modified: Carp-REPL/MANIFEST
==============================================================================
--- Carp-REPL/MANIFEST (original)
+++ Carp-REPL/MANIFEST Tue Sep 11 20:12:36 2007
@@ -29,6 +29,7 @@
t/09-args.t
t/10-nodie.t
t/11-warn.t
+t/12-env.t
t/99-bug.t
t/boilerplate.t
t/scripts/01-trivial.pl
@@ -40,3 +41,4 @@
t/scripts/08-alias.pl
t/scripts/09-args.pl
t/scripts/11-warn.pl
+t/scripts/12-env.pl
Modified: Carp-REPL/META.yml
==============================================================================
--- Carp-REPL/META.yml (original)
+++ Carp-REPL/META.yml Tue Sep 11 20:12:36 2007
@@ -15,11 +15,14 @@
directory:
- inc
- t
+ package:
+ - DB
requires:
+ Data::Dump::Streamer: 0
Devel::LexAlias: 0
Devel::REPL: 0
Moose: 0
Moose::Role: 0
PadWalker: 0
namespace::clean: 0
-version: 0.09
+version: 0.10
Added: Carp-REPL/t/12-env.t
==============================================================================
--- (empty file)
+++ Carp-REPL/t/12-env.t Tue Sep 11 20:12:36 2007
@@ -0,0 +1,84 @@
+#!perl
+use strict;
+use warnings;
+use Test::More tests => 55;
+use Test::Expect;
+
+expect_run
+(
+ command => 'perl -Ilib -MCarp::REPL t/scripts/12-env.pl',
+ prompt => '$ ',
+ quit => 'exit',
+);
+
+expect_send('1 + 1');
+expect_like(qr/\b2\b/, 'in the REPL');
+
+expect_send(':e');
+expect_like(qr/\$Env = {};/);
+
+expect_send(':u');
+expect_like(qr{\bNow at t/scripts/12-env\.pl:42 \(frame 1\)\.});
+
+expect_send(':e');
+expect_like(qr/\$Env = {(?!};)/);
+expect_like(qr/"\\\$alpha" => \\do { my \$v = 1 }/);
+expect_like(qr/"%args" => {/);
+expect_like(qr/Be => 4/);
+expect_like(qr/H => 1/);
+expect_like(qr/He => 2/);
+expect_like(qr/Li => 3/);
+expect_like(qr/"\\\$beta" => \\do { my \$v = 2 }/);
+expect_like(qr/"\\\$delta" => \\do { my \$v = 4 }/);
+expect_like(qr/"\\\$gamma" => \\do { my \$v = 3 }/);
+
+expect_send(':u');
+expect_like(qr{\bNow at t/scripts/12-env\.pl:44 \(frame 2\)\.});
+
+expect_send(':e');
+expect_like(qr/\$Env = {(?!};)/);
+expect_like(qr/"%args" => {/);
+expect_like(qr/Be => 4/);
+expect_like(qr/H => 1/);
+expect_like(qr/He => 2/);
+expect_like(qr/Li => 3/);
+expect_like(qr/\+.*\+.*\+/);
+
+expect_send(':u');
+expect_like(qr{\bNow at t/scripts/12-env\.pl:28 \(frame 3\)\.});
+
+expect_send(':e');
+expect_like(qr/\$Env = {(?!};)/);
+expect_like(qr/"\\\$dos" => \\do { my \$v = 'is' }/);
+expect_like(qr/"\\\$tres" => \\do { my \$v = 'I' }/);
+expect_like(qr/"\\\$uno" => \\do { my \$v = 'I' }/);
+
+expect_send(':u');
+expect_like(qr{\bNow at t/scripts/12-env\.pl:19 \(frame 4\)\.});
+
+expect_send(':e');
+expect_like(qr/\$Env = {(?!};)/);
+expect_like(qr/"\\\$a" => \\do { my \$v = 'I' }/);
+expect_like(qr/"\\\$b" => \\do { my \$v = 'I' }/);
+
+expect_send(':u');
+expect_like(qr{\bNow at t/scripts/12-env\.pl:13 \(frame 5\)\.});
+
+expect_send(':e');
+expect_like(qr/\$Env = { "\\\$num" => \\do { my \$v = 'I' } };/);
+
+expect_send(':u');
+expect_like(qr{\bNow at t/scripts/12-env\.pl:7 \(frame 6\)\.});
+
+expect_send(':e');
+expect_like(qr/\$Env = {};/);
+
+expect_send(':u');
+expect_like(qr{\bNow at t/scripts/12-env\.pl:52 \(frame 7\)\.});
+
+expect_send(':e');
+expect_like(qr/\$Env = {};/);
+
+expect_send(':u');
+expect_like(qr{You're already at the top frame\.});
+
Added: Carp-REPL/t/scripts/12-env.pl
==============================================================================
--- (empty file)
+++ Carp-REPL/t/scripts/12-env.pl Tue Sep 11 20:12:36 2007
@@ -0,0 +1,53 @@
+#!/usr/bin/perl
+use strict;
+use warnings;
+
+sub zero
+{
+ one('I');
+}
+
+sub one
+{
+ my $num = shift;
+ two(($num) x 2);
+}
+
+sub two
+{
+ my ($a, $b) = @_;
+ three($a => is => $b);
+}
+
+sub three
+{
+ my $uno = shift;
+ my $dos = shift;
+ my $tres = shift;
+
+ four(
+ H => 1,
+ He => 2,
+ Li => 3,
+ Be => 4,
+ );
+}
+
+sub four
+{
+ my %args = @_;
+
+ my $closure = sub {
+ my ($alpha, $beta, $gamma, $delta) = @_;
+ five($alpha + $beta + $gamma + $delta);
+ };
+ $closure->(values %args);
+}
+
+sub five
+{
+ die @_;
+}
+
+zero();
+
More information about the Bps-public-commit
mailing list