We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 909b45a commit c7de3f6Copy full SHA for c7de3f6
lib/syntax_tree/node.rb
@@ -288,7 +288,7 @@ def format(q)
288
q.text(value)
289
else
290
q.text(q.quote)
291
- q.text(value[1] == "\"" ? "\\\"" : value[1])
+ q.text(value[1] == q.quote ? "\\#{q.quote}" : value[1])
292
293
end
294
test/plugin/single_quotes_test.rb
@@ -8,6 +8,14 @@ def test_empty_string_literal
8
assert_format("''\n", "\"\"")
9
10
11
+ def test_character_literal_with_double_quote
12
+ assert_format("'\"'\n", "?\"")
13
+ end
14
+
15
+ def test_character_literal_with_singlee_quote
16
+ assert_format("'\\''\n", "?'")
17
18
19
def test_string_literal
20
assert_format("'string'\n", "\"string\"")
21
0 commit comments