================ @@ -16,3 +17,30 @@ def test_file(self): self.assertEqual(str(file), "t.c") self.assertEqual(file.name, "t.c") self.assertEqual(repr(file), "<File: t.c>") + + def test_file_eq(self): + path = os.path.join(inputs_dir, "hello.cpp") + header_path = os.path.join(inputs_dir, "header3.h") + tu = TranslationUnit.from_source(path) + file1 = File.from_name(tu, path) + file2 = File.from_name(tu, header_path) + file2_2 = File.from_name(tu, header_path) + + self.assertEqual(file1, file1) + self.assertEqual(file2, file2_2) + self.assertNotEqual(file1, file2) + self.assertNotEqual(file1, "t.c") + + # FIXME: this test shouldn't pass + def test_file_eq_failing(self): + index = Index.create() + tu = index.parse( + "t.c", + unsaved_files=[ + ("t.c", "int a = 729;"), + ("s.c", "int a = 729;"), + ], + ) + file1 = File.from_name(tu, "t.c") + file2 = File.from_name(tu, "s.c") + self.assertEqual(file1, file2) # These files are not supposed to be equal ---------------- Endilll wrote:
```suggestion # FIXME: These files are not supposed to be equal self.assertEqual(file1, file2) ``` https://github.com/llvm/llvm-project/pull/130383 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits