branch: elpa/subed commit 6d53418aefdd973ffc9c392df614f75a34224a03 Author: Random User <rnd...@posteo.de> Commit: Random User <rnd...@posteo.de>
Add test for killing non-last subtitle --- tests/test-subed-srt.el | 42 ++++++++++++++++++++++++++++-------------- 1 file changed, 28 insertions(+), 14 deletions(-) diff --git a/tests/test-subed-srt.el b/tests/test-subed-srt.el index 11107bb..6ac6664 100644 --- a/tests/test-subed-srt.el +++ b/tests/test-subed-srt.el @@ -929,20 +929,34 @@ Baz. "2\n" "00:02:02,234 --> 00:02:10,345\n" "Bar.\n")))) - (it "removes the previous subtitle when point is right above an ID." - (with-temp-buffer - (insert mock-srt-data) - (subed-jump-to-subtitle-id 3) - (backward-char) - (expect (looking-at "^\n3\n") :to-be t) - (subed-srt--subtitle-kill) - (expect (buffer-string) :to-equal (concat "1\n" - "00:01:01,000 --> 00:01:05,123\n" - "Foo.\n" - "\n" - "3\n" - "00:03:03,45 --> 00:03:15,5\n" - "Baz.\n")))) + (describe "removes the previous subtitle when point is right above the ID" + (it "of the last subtitle." + (with-temp-buffer + (insert mock-srt-data) + (subed-jump-to-subtitle-id 3) + (backward-char) + (expect (looking-at "^\n3\n") :to-be t) + (subed-srt--subtitle-kill) + (expect (buffer-string) :to-equal (concat "1\n" + "00:01:01,000 --> 00:01:05,123\n" + "Foo.\n\n" + "3\n" + "00:03:03,45 --> 00:03:15,5\n" + "Baz.\n")))) + (it "of a non-last subtitle." + (with-temp-buffer + (insert mock-srt-data) + (subed-jump-to-subtitle-id 2) + (backward-char) + (expect (looking-at "^\n2\n") :to-be t) + (subed-srt--subtitle-kill) + (expect (buffer-string) :to-equal (concat "2\n" + "00:02:02,234 --> 00:02:10,345\n" + "Bar.\n\n" + "3\n" + "00:03:03,45 --> 00:03:15,5\n" + "Baz.\n")))) + ) ) (describe "Validating"