@@ -193,7 +193,6 @@ mod tests {
193193 fn test_builtin_django_tags ( ) -> Result < ( ) , anyhow:: Error > {
194194 let specs = TagSpecs :: load_builtin_specs ( ) ?;
195195
196- // Just verify that common Django tags exist
197196 let expected_tags = [ "if" , "for" , "block" ] ;
198197 let missing_tags = [
199198 "extends" ,
@@ -211,19 +210,21 @@ mod tests {
211210 }
212211
213212 for tag in missing_tags {
214- assert ! ( specs. get( tag) . is_none( ) , "{} tag should not be present yet" , tag) ;
213+ assert ! (
214+ specs. get( tag) . is_none( ) ,
215+ "{} tag should not be present yet" ,
216+ tag
217+ ) ;
215218 }
216219
217220 Ok ( ( ) )
218221 }
219222
220223 #[ test]
221224 fn test_user_defined_tags ( ) -> Result < ( ) , anyhow:: Error > {
222- // Create a temporary directory for our test project
223225 let dir = tempfile:: tempdir ( ) ?;
224226 let root = dir. path ( ) ;
225227
226- // Create a pyproject.toml with custom tags
227228 let pyproject_content = r#"
228229[tool.djls.template.tags.mytag]
229230type = "block"
@@ -233,14 +234,11 @@ args = [{ name = "myarg", required = true }]
233234"# ;
234235 fs:: write ( root. join ( "pyproject.toml" ) , pyproject_content) ?;
235236
236- // Load both builtin and user specs
237237 let specs = TagSpecs :: load_all ( root) ?;
238238
239- // Check that builtin tags are still there
240239 let if_tag = specs. get ( "if" ) . expect ( "if tag should be present" ) ;
241240 assert_eq ! ( if_tag. tag_type, TagType :: Block ) ;
242241
243- // Check our custom tag
244242 let my_tag = specs. get ( "mytag" ) . expect ( "mytag should be present" ) ;
245243 assert_eq ! ( my_tag. tag_type, TagType :: Block ) ;
246244 assert_eq ! ( my_tag. closing, Some ( "endmytag" . to_string( ) ) ) ;
@@ -256,18 +254,15 @@ args = [{ name = "myarg", required = true }]
256254 assert_eq ! ( arg. name, "myarg" ) ;
257255 assert ! ( arg. required) ;
258256
259- // Clean up temp dir
260257 dir. close ( ) ?;
261258 Ok ( ( ) )
262259 }
263260
264261 #[ test]
265262 fn test_config_file_priority ( ) -> Result < ( ) , anyhow:: Error > {
266- // Create a temporary directory for our test project
267263 let dir = tempfile:: tempdir ( ) ?;
268264 let root = dir. path ( ) ;
269265
270- // Create all config files with different tags
271266 let djls_content = r#"
272267[mytag1]
273268type = "block"
@@ -282,21 +277,17 @@ mytag2.closing = "endmytag2"
282277"# ;
283278 fs:: write ( root. join ( "pyproject.toml" ) , pyproject_content) ?;
284279
285- // Load user specs
286280 let specs = TagSpecs :: load_user_specs ( root) ?;
287281
288- // Should only have mytag1 since djls.toml has highest priority
289282 assert ! ( specs. get( "mytag1" ) . is_some( ) , "mytag1 should be present" ) ;
290283 assert ! (
291284 specs. get( "mytag2" ) . is_none( ) ,
292285 "mytag2 should not be present"
293286 ) ;
294287
295- // Remove djls.toml and try again
296288 fs:: remove_file ( root. join ( "djls.toml" ) ) ?;
297289 let specs = TagSpecs :: load_user_specs ( root) ?;
298290
299- // Should now have mytag2 since pyproject.toml has second priority
300291 assert ! (
301292 specs. get( "mytag1" ) . is_none( ) ,
302293 "mytag1 should not be present"
0 commit comments