diff options
author | Silvan Mosberger <contact@infinisil.com> | 2020-09-17 17:58:04 +0200 |
---|---|---|
committer | Silvan Mosberger <contact@infinisil.com> | 2020-09-17 18:20:31 +0200 |
commit | 073e9b2aed0f855ce26bd3a26dab044c0c17c817 (patch) | |
tree | 6b0f3bae170b862c336d7820f4b3b2e38ca5f235 /lib/tests | |
parent | 47f2eb89c16a74881c6e1a3b18290bf3d0f94a60 (diff) | |
download | nixpkgs-073e9b2aed0f855ce26bd3a26dab044c0c17c817.tar nixpkgs-073e9b2aed0f855ce26bd3a26dab044c0c17c817.tar.gz nixpkgs-073e9b2aed0f855ce26bd3a26dab044c0c17c817.tar.bz2 nixpkgs-073e9b2aed0f855ce26bd3a26dab044c0c17c817.tar.lz nixpkgs-073e9b2aed0f855ce26bd3a26dab044c0c17c817.tar.xz nixpkgs-073e9b2aed0f855ce26bd3a26dab044c0c17c817.tar.zst nixpkgs-073e9b2aed0f855ce26bd3a26dab044c0c17c817.zip |
lib/generators.toPretty: Improved string printing, handling newlines
Diffstat (limited to 'lib/tests')
-rw-r--r-- | lib/tests/misc.nix | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/lib/tests/misc.nix b/lib/tests/misc.nix index 4fed8ef01c9..813a8e7f815 100644 --- a/lib/tests/misc.nix +++ b/lib/tests/misc.nix @@ -450,7 +450,9 @@ runTests { int = 42; float = 0.1337; bool = true; + emptystring = ""; string = ''fno"rd''; + newlinestring = "\n"; path = /. + "/foo"; null_ = null; function = x: x; @@ -463,7 +465,9 @@ runTests { int = "42"; float = "~0.133700"; bool = "true"; + emptystring = ''""''; string = ''"fno\"rd"''; + newlinestring = "\"\\n\""; path = "/foo"; null_ = "null"; function = "<λ>"; @@ -478,6 +482,16 @@ runTests { expr = mapAttrs (const (generators.toPretty { })) rec { list = [ 3 4 [ false ] ]; attrs = { foo = null; bar.foo = "baz"; }; + newlinestring = "\n"; + multilinestring = '' + hello + there + test + ''; + multilinestring' = '' + hello + there + test''; }; expected = rec { list = '' @@ -495,6 +509,19 @@ runTests { }; foo = null; }''; + newlinestring = "''\n \n''"; + multilinestring = '' + ''' + hello + there + test + '''''; + multilinestring' = '' + ''' + hello + there + test'''''; + }; }; |