diff --git a/tests/header_changed.hancho b/tests/header_changed.hancho index 809a37a..ad9e1a6 100644 --- a/tests/header_changed.hancho +++ b/tests/header_changed.hancho @@ -1,4 +1,10 @@ from hancho import * -rules = load("rules.hancho") +build_config.defaults( + command_path = Path.cwd(), + source_path = Path.cwd(), + build_path = Path.cwd() / "build", +) + +rules = load("rules.hancho", build_config) rules.compile_cpp("src/test.cpp") diff --git a/tests/run_tests.py b/tests/run_tests.py index 575331b..c9805bf 100755 --- a/tests/run_tests.py +++ b/tests/run_tests.py @@ -197,20 +197,20 @@ def test_doesnt_create_output(self): run_hancho("doesnt_create_output") self.assertFalse(path.exists("build/result.txt")) -# def test_header_changed(self): -# """Changing a header file tracked in the GCC depfile should trigger a rebuild""" -# run_hancho("header_changed") -# mtime1 = mtime("build/src/test.o") -# -# run_hancho("header_changed") -# mtime2 = mtime("build/src/test.o") -# -# Path("src/test.hpp").touch() -# run_hancho("header_changed") -# mtime3 = mtime("build/src/test.o") -# self.assertEqual(mtime1, mtime2) -# self.assertLess(mtime2, mtime3) -# + def test_header_changed(self): + """Changing a header file tracked in the GCC depfile should trigger a rebuild""" + run_hancho("header_changed") + mtime1 = mtime("build/src/test.o") + + run_hancho("header_changed") + mtime2 = mtime("build/src/test.o") + + Path("src/test.hpp").touch() + run_hancho("header_changed") + mtime3 = mtime("build/src/test.o") + self.assertEqual(mtime1, mtime2) + self.assertLess(mtime2, mtime3) + # def test_input_changed(self): # """Changing a source file should trigger a rebuild""" # run_hancho("input_changed")