branch: externals/yaml
commit fdc65922c9a5d9a661b9957b7e39e64415580ad3
Author: Zachary Romero <[email protected]>
Commit: Zachary Romero <[email protected]>
fix zero-column indent problems; add more unit tests
---
yaml-tests.el | 11 ++++++++++-
yaml.el | 2 +-
2 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/yaml-tests.el b/yaml-tests.el
index 1421a07aac..9498a337db 100644
--- a/yaml-tests.el
+++ b/yaml-tests.el
@@ -408,7 +408,16 @@ ship-to:
'((deeply (nested (value . " test string"))))))
(should (equal (yaml-parse-string "deeply:\n nested:\n value: |-\n
test string"
:object-type 'alist)
- '((deeply (nested (value . "test string")))))))
+ '((deeply (nested (value . "test string"))))))
+ (should (equal (yaml-parse-string ">-\n this is text"
+ :object-type 'alist)
+ "this is text"))
+ (should (equal (yaml-parse-string ">-1\n this is text"
+ :object-type 'alist)
+ "this is text"))
+ (should (equal (yaml-parse-string "top: |1\n this is text"
+ :object-type 'alist)
+ '((top . " this is text\n")))))
(ert-deftest yaml-parsing-completes ()
"Tests that the yaml parses."
diff --git a/yaml.el b/yaml.el
index 18447416fb..169cf8f4b4 100644
--- a/yaml.el
+++ b/yaml.el
@@ -768,7 +768,7 @@ repeat for each character in a text.")
(cons (1+ beg)
(1+ yaml--parsing-position)))))
(when (member ,name '("c-l+folded" "c-l+literal"))
- (setq str (propertize str 'yaml-n n)))
+ (setq str (propertize str 'yaml-n (max 0 n))))
(list ,name
(if yaml--parsing-store-position
(propertize str 'yaml-position (cons (1+ beg)