From 30e7f369dd175390d9a320a54abbd66b66338764 Mon Sep 17 00:00:00 2001 From: Karl-Hermann Wieners <karl-hermann.wieners@mpimet.mpg.de> Date: Wed, 22 Jun 2016 13:23:12 +0000 Subject: [PATCH] Added tests for global function 'get_file' (see r421) --- test.py | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/test.py b/test.py index 6d8f139..65aa7ca 100644 --- a/test.py +++ b/test.py @@ -496,6 +496,53 @@ class WordwrapTestCase(MkexpSimpleTestCase): tlike-message """) +class FilesTestCase(MkexpSimpleTestCase): + + def test_get_file_simple(self): + self.run_test(""" + %{get_file(files, 'target.txt')} + %{get_file(files, 'broken.txt')} + """, """ + source.txt + . + """, """ + [files] + target.txt = source.txt + broken.txt = . + """) + + def test_get_file_path(self): + self.run_test(""" + %{get_file(files, 'target.txt')} + %{get_file(files, 'path.txt')} + %{get_file(files.subdir, 'target.txt')} + """, """ + /path/to/source/source.txt + /just/this/one/source.txt + /path/to/source/subdir/source.txt + """, """ + [files] + .base_dir = /path/to/source + target.txt = source.txt + path.txt = /just/this/one/source.txt + [[subdir]] + .sub_dir = subdir + target.txt = source.txt + """) + + def test_get_file_variable(self): + self.run_test(""" + %{get_file(files, 'target.txt')} + %{get_file(files, 'broken.txt')} + """, """ + source.txt + $BASENAME.txt + """, """ + BASENAME = source + [files] + target.txt = $${BASENAME}.txt + broken.txt = $$BASENAME.txt + """) if __name__ == '__main__': unittest.main() -- GitLab