Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

repypp.py should have unit tests #161

Open
aaaaalbert opened this issue Feb 6, 2015 · 3 comments
Open

repypp.py should have unit tests #161

aaaaalbert opened this issue Feb 6, 2015 · 3 comments
Assignees

Comments

@aaaaalbert
Copy link
Contributor

repypp.py, the Repy preprocessor, does not have unit tests. This makes testing parts of the build scripts in SeattleTestbed/common difficult.

Things we should probably test:

  • Correct #include statements
  • Erroneous #include statements:
    • include non-existing files,
    • have multiple arguments,
    • have no arguments at all.

(We will want to have realistic-looking Repy programs and realistic-looking libraries to #include for these purposes).

@aaaaalbert
Copy link
Contributor Author

@XuefengHuang suggested we also test calling repypp.py with too few / many arguments. Good point!

I'll also add that we should test lines like
include some_lib.repy # Ensure that comments are ignored, even if preceded by whitespace

@XuefengHuang
Copy link

I have added some unit tests to check different situations as the issue describes. This is my PR(#163).

@asm582
Copy link

asm582 commented May 16, 2015

I have tested this on linux - ubuntu and below are the test cases that pass:

-rw-rw-r-- 1 cib cib 878 May 15 22:07 ut_seattlelibv2_repypp_samearguments.py
-rw-rw-r-- 1 cib cib 777 May 15 22:07 ut_seattlelibv2_repypp_noargument.py
-rw-rw-r-- 1 cib cib 1648 May 15 22:07 ut_seattlelibv2_repypp_multiplearguments.py
-rw-rw-r-- 1 cib cib 1133 May 15 22:07 ut_seattlelibv2_repypp_include_specifiedfile.py
-rw-rw-r-- 1 cib cib 1113 May 15 22:07 ut_seattlelibv2_repypp_include_non-existingfiles.py
-rw-rw-r-- 1 cib cib 1037 May 15 22:07 ut_seattlelibv2_repypp_include_noargument.py
-rw-rw-r-- 1 cib cib 1560 May 15 22:07 ut_seattlelibv2_repypp_include_multiplearguments.py
-rw-rw-r-- 1 cib cib 1274 May 15 22:07 ut_seattlelibv2_repypp_include_filecontent.py
-rw-rw-r-- 1 cib cib 1549 May 15 22:07 test_repypp_library.pyc

Below is the test case that fail:-

cib@cib-VirtualBox:~/xeufeng/seattlelib_v2/RUNNABLE$ python utf.py -f ut_seattlelibv2_repypp_specialcomments.py
Testing module: seattlelibv2

Running: ut_seattlelibv2_repypp_specialcomments.py [ FAIL ]

Standard out :
..............................Produced..............................
Error opening source file 'testfile_repypp_example1.repy # Ensure that comments are ignored, even if preceded by whitespace'
the result of repypp.py produces is not correct!

..............................Expected..............................

None

and test case leaves and trace of file that i think can be removed by os.remove, below is the file:

-rw-rw-r-- 1 cib cib 86 May 15 22:11 testfile_repypp_example3.repy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants