From e75c24e88907f329c57cf05d729dbf599349bb50 Mon Sep 17 00:00:00 2001 From: Philipp Hagemeister Date: Sun, 20 Jul 2014 00:03:54 +0200 Subject: [swfinterp] Extend tests and fix parsing --- test/swftests/StaticAssignment.as | 13 +++++++++++++ test/swftests/StaticRetrieval.as | 16 ++++++++++++++++ test/test_swfinterp.py | 9 ++++++--- 3 files changed, 35 insertions(+), 3 deletions(-) create mode 100644 test/swftests/StaticAssignment.as create mode 100644 test/swftests/StaticRetrieval.as (limited to 'test') diff --git a/test/swftests/StaticAssignment.as b/test/swftests/StaticAssignment.as new file mode 100644 index 000000000..b061c219d --- /dev/null +++ b/test/swftests/StaticAssignment.as @@ -0,0 +1,13 @@ +// input: [1] +// output: 1 + +package { +public class StaticAssignment { + public static var v:int; + + public static function main(a:int):int{ + v = a; + return v; + } +} +} diff --git a/test/swftests/StaticRetrieval.as b/test/swftests/StaticRetrieval.as new file mode 100644 index 000000000..c8352d819 --- /dev/null +++ b/test/swftests/StaticRetrieval.as @@ -0,0 +1,16 @@ +// input: [] +// output: 1 + +package { +public class StaticRetrieval { + public static var v:int; + + public static function main():int{ + if (v) { + return 0; + } else { + return 1; + } + } +} +} diff --git a/test/test_swfinterp.py b/test/test_swfinterp.py index 98a14a006..3bb5a6308 100644 --- a/test/test_swfinterp.py +++ b/test/test_swfinterp.py @@ -23,10 +23,10 @@ class TestSWFInterpreter(unittest.TestCase): pass -for testfile in os.listdir(TEST_DIR): +def _make_testfunc(testfile): m = re.match(r'^(.*)\.(as)$', testfile) if not m: - continue + return test_id = m.group(1) def test_func(self): @@ -36,7 +36,7 @@ for testfile in os.listdir(TEST_DIR): or os.path.getmtime(swf_file) < os.path.getmtime(as_file)): # Recompile try: - subprocess.check_call(['mxmlc', '--output', swf_file, as_file]) + subprocess.check_call(['mxmlc', '-output', swf_file, as_file]) except OSError as ose: if ose.errno == errno.ENOENT: print('mxmlc not found! Skipping test.') @@ -69,5 +69,8 @@ for testfile in os.listdir(TEST_DIR): setattr(TestSWFInterpreter, test_func.__name__, test_func) +for testfile in os.listdir(TEST_DIR): + _make_testfunc(testfile) + if __name__ == '__main__': unittest.main() -- cgit v1.2.3