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