[clang] [libclang/python] Add equality comparison operators for File (PR #130383)

Vlad Serebrennikov via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 20 08:07:37 PDT 2025


================
@@ -16,3 +17,16 @@ 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(kInputsDir, "hello.cpp")
+        header_path = os.path.join(kInputsDir, "header3.h")
+        tu = TranslationUnit.from_source(path)
----------------
Endilll wrote:

You should bring back the test which uses in-memory files, assert that files are not equal, and leave a FIXME that it shouldn't be the case. Would be nice if you read contents of those files from disk, instead of hard-coding them.

https://github.com/llvm/llvm-project/pull/130383


More information about the cfe-commits mailing list