forked from Mermouy/shell2python
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFlow_test.pl
executable file
·36 lines (30 loc) · 1.28 KB
/
Flow_test.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/usr/bin/perl -w
# Matthew Moss
# cs2041, 12s2
use strict;
use Flow;
use Test::More 'no_plan';
is (Flow::can_handle ("if some condition lol"), 1);
is (Flow::can_handle ("elif some condition lol"), 1);
is (Flow::can_handle ("pwd"), 0);
is (Flow::can_handle ("for a in one two three"), 1);
is (Flow::can_handle ("while true"), 1);
is (Flow::get_indent_delta ("then"), 4);
is (Flow::get_indent_delta ("do"), 4);
is (Flow::get_indent_delta ("done"), -4);
is (Flow::get_indent_delta ("fi"), -4);
is (Flow::get_indent_delta ("words"), 0);
is (Flow::get_indent_delta ("elif"), -4);
is (Flow::handle ("do"), "");
is (Flow::handle ("then"), "");
is (Flow::handle ("fi"), "");
is (Flow::handle ("done"), "");
is (Flow::handle ("do pwd"), "subprocess.call(['pwd'])");
is (Flow::handle ("for x in one two three"), "for x in 'one', 'two', 'three':");
is (Flow::handle ("for word in Houston 1202 words"), "for word in 'Houston', 1202, 'words':");
is (Flow::handle ('for file in *.c'), 'for file in sorted(glob.glob("*.c")):');
is (Flow::handle ('while $var'), 'while var:');
is (Flow::handle ('while true'), "while not subprocess.call(['true']):");
is (Flow::handle ('while false'), "while not subprocess.call(['false']):");
is (Flow::handle ('while proc'), "while not subprocess.call(['proc']):");