about summary refs log tree commit diff
path: root/tvix/eval/src/value/string.rs
diff options
context:
space:
mode:
authorVincent Ambo <mail@tazj.in>2022-08-16T21·51+0300
committertazjin <tazjin@tvl.su>2022-09-01T17·41+0000
commit5522ddfbf59dec46c2725d63c350217361cc280c (patch)
treecac88f67674c7f65ed8f305712f15977b7623314 /tvix/eval/src/value/string.rs
parent813fb9847095bad5af6ca6472b9a53b2f911d870 (diff)
fix(tvix/eval): fix several string escapings r/4568
These were missing an additional level of escaping, silly oversight
caught by an upstream test.

Change-Id: I0312084475e4b88c83945614e9aa5b34c6bc3ec2
Reviewed-on: https://cl.tvl.fyi/c/depot/+/6232
Reviewed-by: sterni <sternenseemann@systemli.org>
Reviewed-by: grfn <grfn@gws.fyi>
Tested-by: BuildkiteCI
Diffstat (limited to 'tvix/eval/src/value/string.rs')
-rw-r--r--tvix/eval/src/value/string.rs6
1 files changed, 4 insertions, 2 deletions
diff --git a/tvix/eval/src/value/string.rs b/tvix/eval/src/value/string.rs
index 42d9366b958f..f352281be36a 100644
--- a/tvix/eval/src/value/string.rs
+++ b/tvix/eval/src/value/string.rs
@@ -92,9 +92,11 @@ impl NixString {
 
 fn nix_escape_char(ch: char) -> Option<&'static str> {
     match ch {
-        '\\' => Some("\\"),
-        '"' => Some("\\"),
+        '\\' => Some("\\\\"),
+        '"' => Some("\\\""),
         '\n' => Some("\\n"),
+        '\t' => Some("\\t"),
+        '\r' => Some("\\r"),
         _ => None,
     }
 }