Skip to content

Commit 7fbde25

Browse files
committed
Add tests for issue 157
- `''` escapes `$` in both single- and double-quoted strings. - `$$` cannot start an antiquote. - In a double-quoted string, `\$$` cannot start an antiquote. - In a single-quoted string, `\$$` *can* start an antiquote.
1 parent 80b05d3 commit 7fbde25

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

tests/nix-font-lock-tests.el

+24
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,30 @@ if all of its characters have syntax and face. See
8181
("with" t nix-keyword-face)
8282
("foo" t nix-attribute-face))))
8383

84+
(ert-deftest nix-issue-157 ()
85+
(check-properties
86+
'("\"''$${x}")
87+
'(("\"''$${x}" t font-lock-string-face)))
88+
(check-properties
89+
'("''''$${x}''")
90+
'(("''''$" t font-lock-string-face)
91+
("${" t nix-antiquote-face)
92+
("}" t nix-antiquote-face)))
93+
(check-properties
94+
'("\"$${x}\"")
95+
'(("\"$${x}\"" t font-lock-string-face)))
96+
(check-properties
97+
'("''$${x}''")
98+
'(("''$${x}''" t font-lock-string-face)))
99+
(check-properties
100+
'("\"\\$${x}\"")
101+
'(("\"\\$" t font-lock-string-face)
102+
("${" t nix-antiquote-face)
103+
("}" t nix-antiquote-face)))
104+
(check-properties
105+
'("''\\$${x}''")
106+
'(("''\\$${x}''" t font-lock-string-face))))
107+
84108
;; Local Variables:
85109
;; flycheck-disabled-checkers: (emacs-lisp-checkdoc)
86110
;; End:

0 commit comments

Comments
 (0)