Acme-Pythonic

 view release on metacpan or  search on metacpan

t/labels.t  view on Meta::CPAN

# -*- Mode: Python -*-

use strict;
use warnings;

use Test::More 'no_plan';
use Acme::Pythonic debug => 0;

# ----------------------------------------------------------------------

my @lines = ("foo\n", "bar\n", "baz\n")
LINE: foreach my $line in @lines:
    chomp $line
    if $line eq "bar":
        last LINE

is_deeply(\@lines, ["foo", "bar", "baz\n"]) # in the same line

# ----------------------------------------------------------------------

my $i = 1

FOO:
while $i:
    $i += 1
    last FOO if $i == 10

is($i, 10) # above

# ------------------------------------------------------------------------

my $j = 1

BAR:
# comment
# comment
while $j:
    $j += 1
    last BAR if $j == 10

is $j, 10

# ------------------------------------------------------------------------

my $k = 7
BAZ:
    --$k
    last BAZ if $k < 0
    redo BAZ

is $k, -1

# ----------------------------------------------------------------------

my $eps = 0
ZOO:
    ++$eps
    redo unless $eps == 10
continue:
    $eps = 1

is $eps, 1

# ----------------------------------------------------------------------

# inspired by perlsyn
my @ary1 = (2, 1, 0)



( run in 0.969 second using v1.01-cache-2.11-cpan-e1769b4cff6 )