@@ -159,3 +159,47 @@ fn test_range_negative() -> Result<(), Box<dyn std::error::Error>> {
159159fn test_simple_range ( ) -> Result < ( ) , Box < dyn std:: error:: Error > > {
160160 run_example_test ( "simple_range" , None )
161161}
162+
163+ #[ test]
164+ fn test_line_comments ( ) -> Result < ( ) , Box < dyn std:: error:: Error > > {
165+ run_example_test ( "line_comments" , None )
166+ }
167+
168+ #[ test]
169+ fn test_block_comments ( ) -> Result < ( ) , Box < dyn std:: error:: Error > > {
170+ run_example_test ( "block_comments" , None )
171+ }
172+
173+ #[ test]
174+ fn test_mixed_comments ( ) -> Result < ( ) , Box < dyn std:: error:: Error > > {
175+ run_example_test ( "mixed_comments" , None )
176+ }
177+
178+ #[ test]
179+ #[ test]
180+ fn test_nested_comments ( ) -> Result < ( ) , Box < dyn std:: error:: Error > > {
181+ let workspace_root = std:: path:: Path :: new ( env ! ( "CARGO_MANIFEST_DIR" ) )
182+ . parent ( )
183+ . ok_or ( "couldn't get workspace root" ) ?;
184+
185+ let examples_dir = workspace_root. join ( "examples" ) ;
186+ let example_file = examples_dir. join ( "nested_comments.kit" ) ;
187+
188+ assert ! (
189+ example_file. exists( ) ,
190+ "example file {} does not exist" ,
191+ example_file. display( )
192+ ) ;
193+
194+ // This test should fail to compile due to nested block comments
195+ let kitc = cargo_bin ! ( "kitc" ) ;
196+ let mut cmd = assert_cmd:: Command :: from_std ( std:: process:: Command :: new ( kitc) ) ;
197+ cmd. current_dir ( workspace_root) ;
198+ cmd. arg ( "compile" ) . arg ( & example_file) ;
199+
200+ let result = cmd. assert ( ) ;
201+ // Should fail to compile
202+ assert ! ( result. try_success( ) . is_err( ) ) ;
203+
204+ Ok ( ( ) )
205+ }
0 commit comments