Commits

Shlomi Fish committed 3b29313

Implement *=.

Comments (0)

Files changed (2)

modules/Test-Count/lib/Test/Count/Parser.pm

 assignment:    variable '=' statement   {$thisparser->{vars}->{$item [1]} = $item [3]}
               | variable '+=' statement   {$thisparser->{vars}->{$item [1]} += $item [3]}
               | variable '-=' statement   {$thisparser->{vars}->{$item [1]} -= $item [3]}
+              | variable '*=' statement   {$thisparser->{vars}->{$item [1]} *= $item [3]}
 
 expression:     variable '++'            {$thisparser->{vars}->{$item [1]}++}
               | term '+' expression      {$item [1] + $item [3]}

modules/Test-Count/t/02-main.t

 use strict;
 use warnings;
 
-use Test::More tests => 5;
+use Test::More tests => 6;
 use File::Spec;
 use IO::Scalar;
 
 
     close($in);
 }
+
+{
+    my $_T = 'T' . 'EST';
+    my $buffer = <<"EOF";
+use MyModule;
+
+# ${_T}:\$my_func=10;
+
+# ${_T}:\$c=0;
+
+for my \$idx (1 .. 30)
+{
+    # ${_T}:\$c++;
+    MyModule->my_func("Foo", "Foo \$idx");
+
+    # ${_T}:\$c++;
+    MyModule->my_bar("Bar", "Bar \$idx");
+}
+
+# ${_T}:\$c*=\$my_func;
+# ${_T}:\$foo_loop=\$c;
+# ${_T}*\$foo_loop*30
+
+EOF
+
+    my $in = IO::Scalar->new(\$buffer);
+
+    my $counter = Test::Count->new(
+        {
+            'input_fh' => $in,
+        }
+    );
+
+    my $ret = $counter->process();
+
+    # TEST
+    is ($ret->{'tests_count'}, (10+10)*30,
+        "Handling *=",);
+
+    close($in);
+}
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.