From 17336602d64cf2055b546d17c080e3d5b20be977 Mon Sep 17 00:00:00 2001 From: Kevin Amado Date: Wed, 2 Mar 2022 15:50:44 -0500 Subject: [PATCH] test: add more apply cases --- Cargo.toml | 3 + src/alejandra_engine/tests/cases/apply/in | 95 +++++++++++++++- src/alejandra_engine/tests/cases/apply/out | 123 +++++++++++++++++---- 3 files changed, 197 insertions(+), 24 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index b23b137..22652f0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,8 @@ [profile.release] lto = true +[profile.dev] +opt-level = 2 + [workspace] members = ["src/*"] diff --git a/src/alejandra_engine/tests/cases/apply/in b/src/alejandra_engine/tests/cases/apply/in index 3848271..7b9d6b3 100644 --- a/src/alejandra_engine/tests/cases/apply/in +++ b/src/alejandra_engine/tests/cases/apply/in @@ -1,4 +1,91 @@ -(a b) -(a b) -(a /*b*/ c) -(/*a*/ b /*c*/ d /*e*/) +[ + ( + (a b) + (a b) + (a /*b*/ c) + (/*a*/ b /*c*/ d /*e*/) + ) + '' + otherModules=${ + pkgs.writeText "other-modules.json" + (l.toJSON + (l.mapAttrs + (pname: subOutputs: + let + pkg = subOutputs.packages."${pname}".overrideAttrs (old: { + buildScript = "true"; + installMethod = "copy"; + }); + in + "${pkg}/lib/node_modules/${pname}/node_modules") + outputs.subPackages)) + } + '' + { + name1 = + function + arg + {asdf = 1;}; + + name2 = + function + arg + {asdf = 1;} + argument; + + name3 = + function + arg + {asdf = 1;} + {qwer = 12345;} + argument; + } + { + name1 = function arg { + asdf = 1; + }; + + name2 = function arg { + asdf = 1; + } + argument; + + name3 = function arg { + asdf = 1; + } { + qwer = 12345; + } + argument; + } + { + name4 = + function + arg + {asdf = 1;} + { + qwer = 12345; + qwer2 = 54321; + } + argument; + } + { + option1 = function arg {asdf = 1;} { + qwer = 12345; + qwer2 = 54321; + } + lastArg; + + option2 = function arg {asdf = 1;} { + qwer = 12345; + qwer2 = 54321; + } + lastArg; + + option3 = function arg {asdf = 1;} + { + qwer = 12345; + qwer2 = 54321; + } + lastArg; + } +] diff --git a/src/alejandra_engine/tests/cases/apply/out b/src/alejandra_engine/tests/cases/apply/out index 83c1f48..5bc2dbd 100644 --- a/src/alejandra_engine/tests/cases/apply/out +++ b/src/alejandra_engine/tests/cases/apply/out @@ -1,20 +1,103 @@ -(a b) -(a b) -(a - /* - b - */ - c) -( - /* - a - */ - b - /* - c - */ - d - /* - e - */ -) +[ + ((a b) + (a b) + (a + /* + b + */ + c) + ( + /* + a + */ + b + /* + c + */ + d + /* + e + */ + )) + '' + otherModules=${ + pkgs.writeText "other-modules.json" + (l.toJSON + (l.mapAttrs + (pname: subOutputs: let + pkg = subOutputs.packages."${pname}".overrideAttrs (old: { + buildScript = "true"; + installMethod = "copy"; + }); + in "${pkg}/lib/node_modules/${pname}/node_modules") + outputs.subPackages)) + } + '' + { + name1 = + function + arg + {asdf = 1;}; + + name2 = + function + arg + {asdf = 1;} + argument; + + name3 = + function + arg + {asdf = 1;} + {qwer = 12345;} + argument; + } + { + name1 = function arg { + asdf = 1; + }; + + name2 = function arg { + asdf = 1; + } + argument; + + name3 = function arg { + asdf = 1; + } { + qwer = 12345; + } + argument; + } + { + name4 = + function + arg + {asdf = 1;} + { + qwer = 12345; + qwer2 = 54321; + } + argument; + } + { + option1 = function arg {asdf = 1;} { + qwer = 12345; + qwer2 = 54321; + } + lastArg; + + option2 = function arg {asdf = 1;} { + qwer = 12345; + qwer2 = 54321; + } + lastArg; + + option3 = function arg {asdf = 1;} + { + qwer = 12345; + qwer2 = 54321; + } + lastArg; + } +]