chore: tidy
This commit is contained in:
@@ -77,10 +77,7 @@ fn nested_function_parameters() {
|
||||
|
||||
#[test]
|
||||
fn pattern_param_simple_reference_in_default() {
|
||||
assert_eq!(
|
||||
eval("({ a, b ? a }: b) { a = 10; }"),
|
||||
Value::Int(10)
|
||||
);
|
||||
assert_eq!(eval("({ a, b ? a }: b) { a = 10; }"), Value::Int(10));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -90,8 +90,7 @@ fn import_with_complex_dependency_graph() {
|
||||
std::fs::write(&utils_path, "{ double = x: x * 2; }").unwrap();
|
||||
|
||||
let math_path = temp_dir.path().join("math.nix");
|
||||
let math_content =
|
||||
r#"let utils = import ./utils.nix; in { triple = x: x + utils.double x; }"#;
|
||||
let math_content = r#"let utils = import ./utils.nix; in { triple = x: x + utils.double x; }"#;
|
||||
std::fs::write(&math_path, math_content).unwrap();
|
||||
|
||||
let main_path = temp_dir.path().join("main.nix");
|
||||
|
||||
@@ -5,7 +5,10 @@ use utils::eval;
|
||||
|
||||
#[test]
|
||||
fn string_returns_as_is() {
|
||||
assert_eq!(eval(r#"toString "hello""#), Value::String("hello".to_string()));
|
||||
assert_eq!(
|
||||
eval(r#"toString "hello""#),
|
||||
Value::String("hello".to_string())
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -67,10 +70,7 @@ fn list_with_multiple_empty_lists() {
|
||||
eval("toString [1 [] [] 2]"),
|
||||
Value::String("1 2".to_string())
|
||||
);
|
||||
assert_eq!(
|
||||
eval("toString [[] [] 1]"),
|
||||
Value::String("1".to_string())
|
||||
);
|
||||
assert_eq!(eval("toString [[] [] 1]"), Value::String("1".to_string()));
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -112,7 +112,9 @@ fn attrs_with_to_string_method() {
|
||||
#[test]
|
||||
fn attrs_to_string_self_reference() {
|
||||
assert_eq!(
|
||||
eval(r#"let obj = { x = 42; __toString = self: "x is ${toString self.x}"; }; in toString obj"#),
|
||||
eval(
|
||||
r#"let obj = { x = 42; __toString = self: "x is ${toString self.x}"; }; in toString obj"#
|
||||
),
|
||||
Value::String("x is 42".to_string())
|
||||
);
|
||||
}
|
||||
@@ -120,9 +122,7 @@ fn attrs_to_string_self_reference() {
|
||||
#[test]
|
||||
fn attrs_to_string_priority() {
|
||||
assert_eq!(
|
||||
eval(
|
||||
r#"toString { __toString = self: "custom"; outPath = "/nix/store/foo"; }"#
|
||||
),
|
||||
eval(r#"toString { __toString = self: "custom"; outPath = "/nix/store/foo"; }"#),
|
||||
Value::String("custom".to_string())
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user