@@ -69,10 +69,6 @@ def test_journal_mtime_validation_success(self):
6969
7070 # Hook should succeed
7171 result = subprocess .run (["python3" , "../.gemini/hooks/pre-commit.py" ], capture_output = True , text = True )
72- if result .returncode != 0 :
73- print (f"\n HOOK FAILED (rc={ result .returncode } )" )
74- print (f"STDOUT: { result .stdout } " )
75- print (f"STDERR: { result .stderr } " )
7672 self .assertEqual (result .returncode , 0 )
7773 self .assertIn ("Validation passed" , result .stdout )
7874
@@ -115,5 +111,24 @@ def test_ignore_gemini_files(self):
115111 # But it shouldn't fail with "Updated journal required"
116112 self .assertNotIn ("Updated journal required" , result .stdout + result .stderr )
117113
114+ def test_install_hooks (self ):
115+ # Create a dummy pre-commit script in the test repo so the symlink is not dangling
116+ os .makedirs (".gemini/hooks" , exist_ok = True )
117+ with open (".gemini/hooks/pre-commit.py" , "w" ) as f :
118+ f .write ("#!/usr/bin/env python3\n pass" )
119+
120+ # Create a makefile with install-hooks target (the one we'll implement)
121+ # For now, we'll use the real makefile from the project
122+ shutil .copy ("../makefile" , "makefile" )
123+
124+ # Run make install-hooks
125+ result = subprocess .run (["make" , "install-hooks" ], capture_output = True , text = True )
126+ self .assertEqual (result .returncode , 0 )
127+
128+ # Check if the hook is linked
129+ hook_path = ".git/hooks/pre-commit"
130+ self .assertTrue (os .path .exists (hook_path ))
131+ self .assertTrue (os .access (hook_path , os .X_OK ))
132+
118133if __name__ == "__main__" :
119134 unittest .main ()
0 commit comments