branch: externals/yaml
commit 0bf6a1b6868709c24759a9b478e267090f779841
Author: Zachary Romero <[email protected]>
Commit: Zachary Romero <[email protected]>
YAML anchor should match exactly how it was defined
---
yaml-tests.el | 29 +++++++++++++++++++++++++++++
yaml.el | 2 +-
2 files changed, 30 insertions(+), 1 deletion(-)
diff --git a/yaml-tests.el b/yaml-tests.el
index efa21676ab..8b31e851b0 100644
--- a/yaml-tests.el
+++ b/yaml-tests.el
@@ -355,6 +355,35 @@ key-2: |2-
(yaml-parse-string "bill-to:
city: East Centerville
state: KS
+" :object-type 'alist
+ :object-key-type 'string
+ :string-values t)))
+ ;; anchor should expand to be identical to definition
+ (should (equal (yaml-parse-string "bill-to: &id001
+ street: |
+ 123 Tornado Alley
+ Suite 16
+ city: East Cenrville
+ state: KS
+
+ship-to: *id001
+" :object-type 'alist
+ :object-key-type 'string
+ :string-values t)
+ (yaml-parse-string "bill-to:
+ street: |
+ 123 Tornado Alley
+ Suite 16
+ city: East Cenrville
+ state: KS
+
+ship-to:
+ street: |
+ 123 Tornado Alley
+ Suite 16
+ city: East Cenrville
+ state: KS
+
" :object-type 'alist
:object-key-type 'string
:string-values t))))
diff --git a/yaml.el b/yaml.el
index 11965d3c3b..317b85050b 100644
--- a/yaml.el
+++ b/yaml.el
@@ -414,7 +414,7 @@ This flag is intended for development purposes.")
((equal top-state :anchor)
(let* ((anchor (pop yaml--object-stack))
(name (nth 1 anchor)))
- (puthash name value* yaml--anchor-mappings)
+ (puthash name value yaml--anchor-mappings)
(pop yaml--state-stack)
(yaml--scalar-event nil value)))
((equal top-state :sequence)