Properly fix line break in strings.

This commit is contained in:
José Valim
2011-06-25 11:09:17 -03:00
parent a982ed9ad6
commit 4fed302df0
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -169,7 +169,7 @@ module String
def inspect
list = Erlang.binary_to_list(self)
if Erlang.io_lib.printable_unicode_list(list)
<<$\", gsub(~r{("|#|\n|\r)}, "\\\\\\1")|binary, $\">>
<<$\", gsub(~r{("|#)}, "\\\\\\1").gsub(~r{\n}, "\\\\n")|binary, $\">>
else
Erlang.io_lib.format($"~w", [self]).to_bin
end
+1 -1
View File
@@ -97,7 +97,7 @@ three
"<<1,2,3>>" = <<1,2,3>>.inspect
"\"f\\\"o\\\"o\"" = "f\"o\"o".inspect
"\"f\\\#o\"" = "f#o".inspect
"\"f\\\no\"" = "f\no".inspect
"\"f\\no\"" = "f\no".inspect
end
def to_atom_test