From f4090865d44a9bffd6e67e59fc0c3a04866960ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartosz=20Dziewo=C5=84ski?= Date: Thu, 8 Feb 2024 16:52:59 +0100 Subject: [PATCH] Add test cases for the main loop getting stuck on some signatures Follow-up to 9db35873a499a756b6e94bc6dd0e1e21440606b7. Bug: T356884 Change-Id: Ifef490209fdee2b9f52d3ef81a92ea20c5ff2155 --- tests/cases/comments.json | 16 +++ .../signatures-T356884.html | 3 + .../signatures-T356884.json | 43 ++++++++ .../signatures-T356884b.html | 5 + .../signatures-T356884b.json | 97 +++++++++++++++++++ 5 files changed, 164 insertions(+) create mode 100644 tests/cases/signatures-T356884/signatures-T356884.html create mode 100644 tests/cases/signatures-T356884/signatures-T356884.json create mode 100644 tests/cases/signatures-T356884b/signatures-T356884b.html create mode 100644 tests/cases/signatures-T356884b/signatures-T356884b.json diff --git a/tests/cases/comments.json b/tests/cases/comments.json index f4c561f0b..082e54a17 100644 --- a/tests/cases/comments.json +++ b/tests/cases/comments.json @@ -231,6 +231,22 @@ "config": "../data/enwiki-config.json", "data": "../data/enwiki-data.json" }, + { + "name": "Signature with multiple timestamp in formatting elements causing an infinite loop (T356884)", + "title": "Talk:T356884", + "dom": "cases/signatures-T356884/signatures-T356884.html", + "expected": "../cases/signatures-T356884/signatures-T356884.json", + "config": "../data/enwiki-config.json", + "data": "../data/enwiki-data.json" + }, + { + "name": "Signature with unclosed formatting elements doesn't eat subsequent comments", + "title": "Talk:T356884b", + "dom": "cases/signatures-T356884b/signatures-T356884b.html", + "expected": "../cases/signatures-T356884b/signatures-T356884b.json", + "config": "../data/enwiki-config.json", + "data": "../data/enwiki-data.json" + }, { "name": "Timestamp format switch behavior", "title": "Talk:T304595", diff --git a/tests/cases/signatures-T356884/signatures-T356884.html b/tests/cases/signatures-T356884/signatures-T356884.html new file mode 100644 index 000000000..f87a83095 --- /dev/null +++ b/tests/cases/signatures-T356884/signatures-T356884.html @@ -0,0 +1,3 @@ + +Talk:T356884

test

+

hi Matma Rex 01:01, 7 February 2024 (UTC)
01:02, 7 February 2024 (UTC)

\ No newline at end of file diff --git a/tests/cases/signatures-T356884/signatures-T356884.json b/tests/cases/signatures-T356884/signatures-T356884.json new file mode 100644 index 000000000..d6262c0da --- /dev/null +++ b/tests/cases/signatures-T356884/signatures-T356884.json @@ -0,0 +1,43 @@ +[ + { + "placeholderHeading": false, + "type": "heading", + "range": [ + "1/0/0", + "1/0/1" + ], + "headingLevel": 2, + "level": 0, + "name": "h-Matma_Rex-20240207010100", + "id": "h-test-20240207010100", + "warnings": [], + "replies": [ + { + "type": "comment", + "timestamp": "20240207010100", + "author": "Matma Rex", + "range": [ + "1/2/0", + "1/2/3/0/28" + ], + "signatureRanges": [ + [ + "1/2/1", + "1/2/4" + ] + ], + "timestampRanges": [ + [ + "1/2/3/0/0", + "1/2/3/0/28" + ] + ], + "level": 1, + "name": "c-Matma_Rex-20240207010100", + "id": "c-Matma_Rex-20240207010100-test", + "warnings": [], + "replies": [] + } + ] + } +] diff --git a/tests/cases/signatures-T356884b/signatures-T356884b.html b/tests/cases/signatures-T356884b/signatures-T356884b.html new file mode 100644 index 000000000..55fbfee0c --- /dev/null +++ b/tests/cases/signatures-T356884b/signatures-T356884b.html @@ -0,0 +1,5 @@ + +Talk:T356884b

test

+

hi Matma Rex 00:01, 7 February 2024 (UTC)

+
hi Matma Rex 00:02, 7 February 2024 (UTC) +
hi Matma Rex 00:03, 7 February 2024 (UTC)
\ No newline at end of file diff --git a/tests/cases/signatures-T356884b/signatures-T356884b.json b/tests/cases/signatures-T356884b/signatures-T356884b.json new file mode 100644 index 000000000..17e8d5eff --- /dev/null +++ b/tests/cases/signatures-T356884b/signatures-T356884b.json @@ -0,0 +1,97 @@ +[ + { + "placeholderHeading": false, + "type": "heading", + "range": [ + "1/0/0", + "1/0/1" + ], + "headingLevel": 2, + "level": 0, + "name": "h-Matma_Rex-20240207000100", + "id": "h-test-20240207000100", + "warnings": [], + "replies": [ + { + "type": "comment", + "timestamp": "20240207000100", + "author": "Matma Rex", + "range": [ + "1/2/0", + "1/2/2/29" + ], + "signatureRanges": [ + [ + "1/2/1", + "1/2/2/29" + ] + ], + "timestampRanges": [ + [ + "1/2/2/1", + "1/2/2/29" + ] + ], + "level": 1, + "name": "c-Matma_Rex-20240207000100", + "id": "c-Matma_Rex-20240207000100-test", + "warnings": [], + "replies": [ + { + "type": "comment", + "timestamp": "20240207000200", + "author": "Matma Rex", + "range": [ + "1/4/0/0", + "1/4/0/1/1/29" + ], + "signatureRanges": [ + [ + "1/4/0/1/0", + "1/4/0/1/1/29" + ] + ], + "timestampRanges": [ + [ + "1/4/0/1/1/1", + "1/4/0/1/1/29" + ] + ], + "level": 2, + "name": "c-Matma_Rex-20240207000200", + "id": "c-Matma_Rex-20240207000200-Matma_Rex-20240207000100", + "warnings": [], + "replies": [ + { + "type": "comment", + "timestamp": "20240207000300", + "author": "Matma Rex", + "range": [ + "1/4/0/1/2/0/0", + "1/4/0/1/2/0/2/30" + ], + "signatureRanges": [ + [ + "1/4/0/1/2/0/1", + "1/4/0/1/2/0/2/30" + ] + ], + "timestampRanges": [ + [ + "1/4/0/1/2/0/2/2", + "1/4/0/1/2/0/2/30" + ] + ], + "level": 3, + "name": "c-Matma_Rex-20240207000300", + "id": "c-Matma_Rex-20240207000300-Matma_Rex-20240207000200", + "warnings": [], + "replies": [] + } + ] + } + ] + } + ] + } +]