Acme-Pythonic

 view release on metacpan or  search on metacpan

t/do.t  view on Meta::CPAN

# -*- Mode: Python -*-

use warnings;

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

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

my $z = 4
do:
    $z *= 2
    $z += 1
if $z == 4

is $z, 9

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

do:
    $z *= 2
    $z += 1
unless $z == 4

is $z, 19

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

my $k = 1
do:
    $k *= 2
    $k += 1
# The module should be robust
     # to these comments after a do {}
          # no matter the leading whitespace
while $k < 10

is $k, 15

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

$k = 1
do:
    $k *= 2
    $k += 1
# The module should be robust to these comments after a do {} even if
# they contain something misleading like
# while $k < 9;
while $k < 0:
    pass

is $k, 3


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

$k = 1
do:
    $k *= 2
    $k += 1
until $k > 10

is $k, 15

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



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