@@ -317,3 +317,61 @@ def test_backout_removed_file(mock_secrets, fake_hg_repo):
317
317
1 : {"file" : {"coverage" : "NUCCCCU" , "lines_added" : 7 , "lines_covered" : 5 }},
318
318
2 : {},
319
319
}
320
+
321
+
322
+ def test_third_party (mock_secrets , fake_hg_repo ):
323
+ hg , local , remote = fake_hg_repo
324
+
325
+ add_file (hg , local , "tools/rewriting/ThirdPartyPaths.txt" , "third_party\n some/path" )
326
+ revision = commit (hg , 1 )
327
+
328
+ phabricator = PhabricatorUploader (local , revision )
329
+
330
+ assert phabricator .third_parties == ["third_party" , "some/path" ]
331
+
332
+ assert phabricator .is_third_party ("js/src/xx.cpp" ) is False
333
+ assert phabricator .is_third_party ("dom/media/yyy.h" ) is False
334
+ assert phabricator .is_third_party ("third_party/test.cpp" ) is True
335
+ assert phabricator .is_third_party ("some/test.cpp" ) is False
336
+ assert phabricator .is_third_party ("some/path/test.cpp" ) is True
337
+
338
+
339
+ def test_supported_extensions (mock_secrets , fake_hg_repo ):
340
+ hg , local , remote = fake_hg_repo
341
+
342
+ add_file (hg , local , "file" , "1\n 2\n 3\n 4\n 5\n 6\n 7\n " )
343
+ revision = commit (hg , 1 )
344
+
345
+ phabricator = PhabricatorUploader (local , revision )
346
+
347
+ assert phabricator .is_supported_extension ("README" ) is False
348
+ assert phabricator .is_supported_extension ("requirements.txt" ) is False
349
+ assert phabricator .is_supported_extension ("tools/Cargo.toml" ) is False
350
+ assert phabricator .is_supported_extension ("tools/Cargo.lock" ) is False
351
+ assert phabricator .is_supported_extension ("rust/code.rs" ) is False
352
+ assert phabricator .is_supported_extension ("dom/feature.idl" ) is False
353
+ assert phabricator .is_supported_extension ("dom/feature.webidl" ) is False
354
+ assert phabricator .is_supported_extension ("xpcom/moz.build" ) is False
355
+ assert phabricator .is_supported_extension ("payload.json" ) is False
356
+ assert phabricator .is_supported_extension ("inline.patch" ) is False
357
+ assert phabricator .is_supported_extension ("README.mozilla" ) is False
358
+ assert phabricator .is_supported_extension ("config.yml" ) is False
359
+ assert phabricator .is_supported_extension ("config.yaml" ) is False
360
+ assert phabricator .is_supported_extension ("config.ini" ) is False
361
+ assert phabricator .is_supported_extension ("tooling.py" ) is False
362
+
363
+ assert phabricator .is_supported_extension ("test.cpp" ) is True
364
+ assert phabricator .is_supported_extension ("some/path/to/test.cpp" ) is True
365
+ assert phabricator .is_supported_extension ("xxxYYY.h" ) is True
366
+ assert phabricator .is_supported_extension ("test.c" ) is True
367
+ assert phabricator .is_supported_extension ("test.cc" ) is True
368
+ assert phabricator .is_supported_extension ("test.cxx" ) is True
369
+ assert phabricator .is_supported_extension ("test.hh" ) is True
370
+ assert phabricator .is_supported_extension ("test.hpp" ) is True
371
+ assert phabricator .is_supported_extension ("test.hxx" ) is True
372
+ assert phabricator .is_supported_extension ("test.js" ) is True
373
+ assert phabricator .is_supported_extension ("test.jsm" ) is True
374
+ assert phabricator .is_supported_extension ("test.xul" ) is True
375
+ assert phabricator .is_supported_extension ("test.xml" ) is True
376
+ assert phabricator .is_supported_extension ("test.html" ) is True
377
+ assert phabricator .is_supported_extension ("test.xhtml" ) is True
0 commit comments