[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/subed 9078a46 303/389: subed-srt--validate: Don't complain
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/subed 9078a46 303/389: subed-srt--validate: Don't complain if buffer contains only whitespace |
Date: |
Fri, 3 Dec 2021 11:00:46 -0500 (EST) |
branch: elpa/subed
commit 9078a46b745b92fd57454af5e782332308014bae
Author: Random User <rndusr@posteo.de>
Commit: Random User <rndusr@posteo.de>
subed-srt--validate: Don't complain if buffer contains only whitespace
---
subed/subed-srt.el | 3 ++-
tests/test-subed-srt.el | 19 ++++++++++++++++++-
2 files changed, 20 insertions(+), 2 deletions(-)
diff --git a/subed/subed-srt.el b/subed/subed-srt.el
index 83bd2d4..c9ddb9b 100644
--- a/subed/subed-srt.el
+++ b/subed/subed-srt.el
@@ -504,7 +504,8 @@ scheduled call is canceled and another call is scheduled in
(save-match-data
(let ((orig-point (point)))
(goto-char (point-min))
- (while (re-search-forward (format "\\(%s[[^\\']]\\|\\`\\)"
subed-srt--regexp-separator) nil t)
+ (while (and (re-search-forward (format "\\(%s[[^\\']]\\|\\`\\)"
subed-srt--regexp-separator) nil t)
+ (looking-at "[[:alnum:]]"))
(unless (looking-at "^[0-9]+$")
(error "Found invalid subtitle ID: %S" (substring (or
(thing-at-point 'line :no-properties) "\n") 0 -1)))
(forward-line)
diff --git a/tests/test-subed-srt.el b/tests/test-subed-srt.el
index 2ae1832..a4af646 100644
--- a/tests/test-subed-srt.el
+++ b/tests/test-subed-srt.el
@@ -1186,7 +1186,24 @@ Baz.
(describe "Validating"
(it "works in empty buffer."
(with-temp-srt-buffer
- (expect (subed-srt--validate) :to-be nil)))
+ (subed-srt--validate)))
+ (it "works in buffer that contains only newlines."
+ (with-temp-srt-buffer
+ (cl-loop for _ from 1 to 10 do
+ (insert "\n")
+ (subed-srt--validate))))
+ (it "works in buffer that contains only spaces."
+ (with-temp-srt-buffer
+ (cl-loop for _ from 1 to 10 do
+ (insert " ")
+ (subed-srt--validate))))
+ (it "works in buffer that contains only spaces and newlines."
+ (with-temp-srt-buffer
+ (cl-loop for _ from 1 to 10 do
+ (if (eq (random 2) 0)
+ (insert " ")
+ (insert "\n"))
+ (subed-srt--validate))))
(it "reports invalid IDs."
(with-temp-srt-buffer
(insert mock-srt-data)
- [nongnu] elpa/subed 11a1993 275/389: Don't modify kill-ring when regenerating IDs, (continued)
- [nongnu] elpa/subed 11a1993 275/389: Don't modify kill-ring when regenerating IDs, ELPA Syncer, 2021/12/03
- [nongnu] elpa/subed e3d4f46 283/389: Reword test description, ELPA Syncer, 2021/12/03
- [nongnu] elpa/subed fcc1951 288/389: Add subed-mpv-file-loaded-hook, ELPA Syncer, 2021/12/03
- [nongnu] elpa/subed d87e2cd 290/389: Add save-place-local-mode to example config, ELPA Syncer, 2021/12/03
- [nongnu] elpa/subed e7ae26e 292/389: Add target: clean, ELPA Syncer, 2021/12/03
- [nongnu] elpa/subed 73e11d4 291/389: Define subed-mode as derived mode, ELPA Syncer, 2021/12/03
- [nongnu] elpa/subed df96747 297/389: Rename subed-mpv--handle-event -> subed-mpv--client-handle-event, ELPA Syncer, 2021/12/03
- [nongnu] elpa/subed 4ef1646 298/389: subed-mpv-find-video: Kill previous mpv instance if existing, ELPA Syncer, 2021/12/03
- [nongnu] elpa/subed 0872ab7 299/389: Remove "subed-mode enabled" message, ELPA Syncer, 2021/12/03
- [nongnu] elpa/subed 6215cb1 300/389: Add test-compile target, ELPA Syncer, 2021/12/03
- [nongnu] elpa/subed 9078a46 303/389: subed-srt--validate: Don't complain if buffer contains only whitespace,
ELPA Syncer <=
- [nongnu] elpa/subed f2f11ca 305/389: subed-mpv-find-video: Gracefully handle new file, ELPA Syncer, 2021/12/03
- [nongnu] elpa/subed fabc7dc 306/389: Move function around, ELPA Syncer, 2021/12/03
- [nongnu] elpa/subed aecaf3d 309/389: Better support for fill-paragraph, ELPA Syncer, 2021/12/03
- [nongnu] elpa/subed d34bdec 310/389: Fix mismatched parens in example config, ELPA Syncer, 2021/12/03
- [nongnu] elpa/subed 66889a1 311/389: Fix test: Renumbering does not modify the kill-ring, ELPA Syncer, 2021/12/03
- [nongnu] elpa/subed e1fd29b 312/389: subed-srt--regenerate-ids: Do not modify empty buffer, ELPA Syncer, 2021/12/03
- [nongnu] elpa/subed ca015d4 313/389: Fix one compile warning, ELPA Syncer, 2021/12/03
- [nongnu] elpa/subed 317c411 314/389: Remove declarations, ELPA Syncer, 2021/12/03
- [nongnu] elpa/subed 72020af 315/389: Use long options, ELPA Syncer, 2021/12/03
- [nongnu] elpa/subed be43268 316/389: Fix test-compile target, ELPA Syncer, 2021/12/03