summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/test_metamerge.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
commit36d22d82aa202bb199967e9512281e9a53db42c9 (patch)
tree105e8c98ddea1c1e4784a60a5a6410fa416be2de /testing/web-platform/test_metamerge.py
parentInitial commit. (diff)
downloadfirefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz
firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip
Adding upstream version 115.7.0esr.upstream/115.7.0esr
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/test_metamerge.py')
-rw-r--r--testing/web-platform/test_metamerge.py227
1 files changed, 227 insertions, 0 deletions
diff --git a/testing/web-platform/test_metamerge.py b/testing/web-platform/test_metamerge.py
new file mode 100644
index 0000000000..b3533d89ee
--- /dev/null
+++ b/testing/web-platform/test_metamerge.py
@@ -0,0 +1,227 @@
+from io import BytesIO
+
+import metamerge
+import mozunit
+
+ancestor = """
+global-new-deleted: A
+global-new-changed: A
+global-current-deleted: A
+global-current-changed: A
+
+[failing-test.html]
+ [Unchanged subtest]
+ expected: FAIL
+
+ [New deleted subtest]
+ expected: FAIL
+
+ [New modified subtest]
+ expected: TIMEOUT
+
+ [Current deleted subtest]
+ expected: FAIL
+
+ [New modified current deleted]
+ expected: FAIL
+
+ [Ancestor no expected new expected]
+ bug: 1234
+
+[new-deleted-test.html]
+ [Deleted subtest]
+ expected: FAIL
+
+[current-deleted-test.html]
+ [Deleted subtest]
+ expected: FAIL
+
+[test-modified.html]
+ expected: TIMEOUT
+
+[new-modified-current-deleted.html]
+ expected:
+ if os == "linux": FAIL
+ TIMEOUT
+
+[new-add-expected-with-subtest.html]
+ [subtest]
+ expected: FAIL
+
+[current-add-expected-with-subtest.html]
+ [subtest]
+ expected: FAIL
+"""
+
+new = """
+global-new-added: A
+global-new-changed: B
+global-current-deleted: A
+global-current-changed: A
+
+[failing-test.html]
+ [Unchanged subtest]
+ expected: FAIL
+
+ [New added subtest]
+ expected: FAIL
+
+ [New modified subtest]
+ expected:
+ if os == "linux": FAIL
+ TIMEOUT
+
+ [Current deleted subtest]
+ expected: FAIL
+
+ [New modified current deleted]
+ expected: TIMEOUT
+
+ [Ancestor no expected new expected]
+ bug: 1234
+ expected: FAIL
+
+[new-added-test.html]
+ [Added subtest]
+ expected: FAIL
+
+[current-deleted-test.html]
+ [Deleted subtest]
+ expected: FAIL
+
+[test-modified.html]
+ expected:
+ if os == "linux": FAIL
+
+[new-modified-current-deleted.html]
+ expected:
+ if os == "linux": FAIL
+ if os == "mac": FAIL
+ TIMEOUT
+
+[new-add-expected-with-subtest.html]
+ expected: FAIL
+ [subtest]
+ expected: FAIL
+
+[current-add-expected-with-subtest.html]
+ [subtest]
+ expected: FAIL
+"""
+
+current = """
+global-new-deleted: A
+global-new-changed: A
+global-current-added: A
+global-current-changed: B
+
+[failing-test.html]
+ [Unchanged subtest]
+ expected: FAIL
+
+ [New deleted subtest]
+ expected: FAIL
+
+ [New modified subtest]
+ expected: TIMEOUT
+
+ [Current added subtest]
+ expected: FAIL
+
+ [Ancestor no expected new expected]
+ bug: 1234
+
+[new-deleted-test.html]
+ [Deleted subtest]
+ expected: FAIL
+
+[current-added-test.html]
+ [Added subtest]
+ expected: FAIL
+
+[new-add-expected-with-subtest.html]
+ [subtest]
+ expected: FAIL
+
+[current-add-expected-with-subtest.html]
+ expected: FAIL
+ [subtest]
+ expected: FAIL
+"""
+
+updated = """global-new-deleted: A
+global-new-changed: A
+global-current-added: A
+global-current-changed: B
+[failing-test.html]
+ [Unchanged subtest]
+ expected: FAIL
+
+ [New modified subtest]
+ expected:
+ if os == "linux": FAIL
+ TIMEOUT
+
+ [Current added subtest]
+ expected: FAIL
+
+ [Ancestor no expected new expected]
+ expected: FAIL
+ bug: 1234
+
+ [New added subtest]
+ expected: FAIL
+
+ [New modified current deleted]
+ expected: TIMEOUT
+
+
+[current-added-test.html]
+ [Added subtest]
+ expected: FAIL
+
+
+[new-add-expected-with-subtest.html]
+ expected: FAIL
+ [subtest]
+ expected: FAIL
+
+
+[current-add-expected-with-subtest.html]
+ expected: FAIL
+ [subtest]
+ expected: FAIL
+
+
+[new-added-test.html]
+ [Added subtest]
+ expected: FAIL
+
+
+[test-modified.html]
+ expected:
+ if os == "linux": FAIL
+
+[new-modified-current-deleted.html]
+ expected:
+ if os == "linux": FAIL
+ if os == "mac": FAIL
+ TIMEOUT
+"""
+
+
+def test_merge():
+ def get_manifest(str_data):
+ bytes_io = BytesIO(str_data.encode("utf-8"))
+ return metamerge.compile(bytes_io, metamerge.data_cls_getter)
+
+ ancestor_manifest = get_manifest(ancestor)
+ current_manifest = get_manifest(current)
+ new_manifest = get_manifest(new)
+
+ result = metamerge.make_changes(ancestor_manifest, current_manifest, new_manifest)
+ assert result == updated
+
+
+if __name__ == "__main__":
+ mozunit.main()