wip -- convert remaining tests to use check

This commit is contained in:
2025-12-30 12:28:53 -07:00
parent 04c205b31d
commit 8c8ae23a27
7 changed files with 423 additions and 105 deletions

103
TEST_CONVERSION_GUIDE.md Normal file
View File

@@ -0,0 +1,103 @@
# Test Conversion Guide: `compile! { debug }` to `compile! { check }`
## Overview
The `compile! { check ... }` macro variant returns a `CompilationCheckResult` with both compilation errors and the compiled output. This allows tests to assert that no compilation errors occurred while also checking the output.
## Pattern
### Before (using `debug`):
```rust
#[test]
fn my_test() -> anyhow::Result<()> {
let compiled = compile! {
debug "
let x = 42;
"
};
assert_eq!(
compiled,
indoc! {
"
j main
main:
move r8 42
"
}
);
Ok(())
}
```
### After (using `check`):
```rust
#[test]
fn my_test() -> anyhow::Result<()> {
let result = compile! {
check "
let x = 42;
"
};
assert!(result.errors.is_empty(), "Expected no errors, got: {:?}", result.errors);
assert_eq!(
result.output,
indoc! {
"
j main
main:
move r8 42
"
}
);
Ok(())
}
```
## Key Changes
1. **Variable name**: Change `let compiled =` to `let result =`
2. **Macro variant**: Change `debug` to `check`
3. **Add error assertion**: Insert `assert!(result.errors.is_empty(), ...);` after the compile block
4. **Update assertion target**: Change `compiled` to `result.output` in the assert_eq!
## Multi-line format
When using multi-line source code in the macro:
```rust
let result = compile! {
check
"
let x = 10;
let y = 20;
"
};
assert!(result.errors.is_empty(), "Expected no errors, got: {:?}", result.errors);
assert_eq!(
result.output,
indoc! {
"
j main
main:
move r8 10
move r9 20
"
}
);
```
## Status
-`declaration_literal.rs` - Fully converted (7 tests)
- ⏳ Other files - Pending conversion
To convert a file, replace all occurrences following the pattern above.

View File

@@ -4,7 +4,7 @@ use pretty_assertions::assert_eq;
#[test]
fn variable_declaration_numeric_literal() -> anyhow::Result<()> {
let compiled = crate::compile! {
debug r#"
check r#"
let i = 20c;
"#
};
@@ -26,7 +26,7 @@ fn variable_declaration_numeric_literal() -> anyhow::Result<()> {
#[test]
fn variable_declaration_numeric_literal_stack_spillover() -> anyhow::Result<()> {
let compiled = compile! {
debug
check
r#"
let a = 0;
let b = 1;
@@ -67,7 +67,7 @@ fn variable_declaration_numeric_literal_stack_spillover() -> anyhow::Result<()>
#[test]
fn variable_declaration_negative() -> anyhow::Result<()> {
let compiled = compile! {
debug
check
"
let i = -1;
"
@@ -90,7 +90,7 @@ fn variable_declaration_negative() -> anyhow::Result<()> {
#[test]
fn test_boolean_declaration() -> anyhow::Result<()> {
let compiled = compile! {
debug
check
"
let t = true;
let f = false;
@@ -115,7 +115,7 @@ fn test_boolean_declaration() -> anyhow::Result<()> {
#[test]
fn test_boolean_return() -> anyhow::Result<()> {
let compiled = compile! {
debug
check
"
fn getTrue() {
return true;
@@ -172,7 +172,7 @@ fn test_const_hash_expr() -> anyhow::Result<()> {
#[test]
fn test_declaration_is_const() -> anyhow::Result<()> {
let compiled = compile! {
debug
check
r#"
const MAX = 100;

View File

@@ -4,13 +4,13 @@ use pretty_assertions::assert_eq;
#[test]
fn device_declaration() -> anyhow::Result<()> {
let compiled = compile! {
debug "
check "
device d0 = \"d0\";
"
};
// Declaration only emits the jump label header
assert_eq!(compiled, "j main\n");
assert_eq!(compiled.output, "j main\n");
Ok(())
}
@@ -18,7 +18,7 @@ fn device_declaration() -> anyhow::Result<()> {
#[test]
fn device_property_read() -> anyhow::Result<()> {
let compiled = compile! {
debug "
check "
device ac = \"d0\";
let temp = ac.Temperature;
"
@@ -42,7 +42,7 @@ fn device_property_read() -> anyhow::Result<()> {
#[test]
fn device_property_write() -> anyhow::Result<()> {
let compiled = compile! {
debug "
check "
device ac = \"d0\";
ac.On = 1;
"
@@ -65,7 +65,7 @@ fn device_property_write() -> anyhow::Result<()> {
#[test]
fn multiple_device_declarations() -> anyhow::Result<()> {
let compiled = compile! {
debug "
check "
device d0 = \"d0\";
device d1 = \"d1\";
device d2 = \"d2\";
@@ -73,7 +73,7 @@ fn multiple_device_declarations() -> anyhow::Result<()> {
};
// Declarations only emit the header when unused
assert_eq!(compiled, "j main\n");
assert_eq!(compiled.output, "j main\n");
Ok(())
}
@@ -81,7 +81,7 @@ fn multiple_device_declarations() -> anyhow::Result<()> {
#[test]
fn device_with_variable_interaction() -> anyhow::Result<()> {
let compiled = compile! {
debug "
check "
device sensor = \"d0\";
let reading = sensor.Temperature;
let threshold = 373.15;
@@ -110,7 +110,7 @@ fn device_with_variable_interaction() -> anyhow::Result<()> {
#[test]
fn device_property_in_arithmetic() -> anyhow::Result<()> {
let compiled = compile! {
debug "
check "
device d0 = \"d0\";
let result = d0.Temperature + 100;
"
@@ -136,7 +136,7 @@ fn device_property_in_arithmetic() -> anyhow::Result<()> {
#[test]
fn device_used_in_function() -> anyhow::Result<()> {
let compiled = compile! {
debug "
check "
device d0 = \"d0\";
fn check_power() {
@@ -173,7 +173,7 @@ fn device_used_in_function() -> anyhow::Result<()> {
#[test]
fn device_in_conditional() -> anyhow::Result<()> {
let compiled = compile! {
debug "
check "
device d0 = \"d0\";
if (d0.On) {
@@ -202,7 +202,7 @@ fn device_in_conditional() -> anyhow::Result<()> {
#[test]
fn device_property_with_underscore_name() -> anyhow::Result<()> {
let compiled = compile! {
debug "
check "
device cool_device = \"d0\";
let value = cool_device.SomeProperty;
"

View File

@@ -167,15 +167,21 @@ fn temperature_unit_conversion() -> anyhow::Result<()> {
#[test]
fn mixed_temperature_units() -> anyhow::Result<()> {
let compiled = compile! {
debug "
check "
let c = 0c;
let f = 32f;
let k = 273.15k;
"
};
assert!(
compiled.errors.is_empty(),
"Expected no errors, got: {:?}",
compiled.errors
);
assert_eq!(
compiled,
compiled.output,
indoc! {
"
j main
@@ -193,15 +199,21 @@ fn mixed_temperature_units() -> anyhow::Result<()> {
#[test]
fn boolean_constant_folding() -> anyhow::Result<()> {
let compiled = compile! {
debug "
check "
let x = true;
let y = false;
let z = true && true;
"
};
assert!(
compiled.errors.is_empty(),
"Expected no errors, got: {:?}",
compiled.errors
);
assert_eq!(
compiled,
compiled.output,
indoc! {
"
j main
@@ -220,7 +232,7 @@ fn boolean_constant_folding() -> anyhow::Result<()> {
#[test]
fn empty_block() -> anyhow::Result<()> {
let compiled = compile! {
debug "
check "
let x = 5;
{
}
@@ -228,8 +240,14 @@ fn empty_block() -> anyhow::Result<()> {
"
};
assert!(
compiled.errors.is_empty(),
"Expected no errors, got: {:?}",
compiled.errors
);
assert_eq!(
compiled,
compiled.output,
indoc! {
"
j main
@@ -246,13 +264,19 @@ fn empty_block() -> anyhow::Result<()> {
#[test]
fn multiple_statements_same_line() -> anyhow::Result<()> {
let compiled = compile! {
debug "
check "
let x = 1; let y = 2; let z = 3;
"
};
assert!(
compiled.errors.is_empty(),
"Expected no errors, got: {:?}",
compiled.errors
);
assert_eq!(
compiled,
compiled.output,
indoc! {
"
j main
@@ -270,7 +294,7 @@ fn multiple_statements_same_line() -> anyhow::Result<()> {
#[test]
fn function_with_no_return() -> anyhow::Result<()> {
let compiled = compile! {
debug "
check "
fn no_return() {
let x = 5;
};
@@ -279,8 +303,14 @@ fn function_with_no_return() -> anyhow::Result<()> {
"
};
assert!(
compiled.errors.is_empty(),
"Expected no errors, got: {:?}",
compiled.errors
);
assert_eq!(
compiled,
compiled.output,
indoc! {
"
j main
@@ -303,13 +333,19 @@ fn function_with_no_return() -> anyhow::Result<()> {
#[test]
fn deeply_nested_expressions() -> anyhow::Result<()> {
let compiled = compile! {
debug "
check "
let x = ((((((((1 + 2) + 3) + 4) + 5) + 6) + 7) + 8) + 9);
"
};
assert!(
compiled.errors.is_empty(),
"Expected no errors, got: {:?}",
compiled.errors
);
assert_eq!(
compiled,
compiled.output,
indoc! {
"
j main
@@ -325,13 +361,19 @@ fn deeply_nested_expressions() -> anyhow::Result<()> {
#[test]
fn constant_folding_with_operations() -> anyhow::Result<()> {
let compiled = compile! {
debug "
check "
let x = 10 * 5 + 3 - 2;
"
};
assert!(
compiled.errors.is_empty(),
"Expected no errors, got: {:?}",
compiled.errors
);
assert_eq!(
compiled,
compiled.output,
indoc! {
"
j main
@@ -347,13 +389,19 @@ fn constant_folding_with_operations() -> anyhow::Result<()> {
#[test]
fn constant_folding_with_division() -> anyhow::Result<()> {
let compiled = compile! {
debug "
check "
let x = 100 / 2 / 5;
"
};
assert!(
compiled.errors.is_empty(),
"Expected no errors, got: {:?}",
compiled.errors
);
assert_eq!(
compiled,
compiled.output,
indoc! {
"
j main
@@ -369,14 +417,19 @@ fn constant_folding_with_division() -> anyhow::Result<()> {
#[test]
fn modulo_operation() -> anyhow::Result<()> {
let compiled = compile! {
debug "
check "
let x = 17 % 5;
let y = 10 % 3;
"
};
assert!(
compiled.errors.is_empty(),
"Expected no errors, got: {:?}",
compiled.errors
);
assert_eq!(
compiled,
compiled.output,
indoc! {
"
j main
@@ -393,14 +446,20 @@ fn modulo_operation() -> anyhow::Result<()> {
#[test]
fn exponentiation() -> anyhow::Result<()> {
let compiled = compile! {
debug "
check "
let x = 2 ^ 8;
let y = 3 ^ 3;
"
};
assert!(
compiled.errors.is_empty(),
"Expected no errors, got: {:?}",
compiled.errors
);
assert_eq!(
compiled,
compiled.output,
indoc! {
"
j main
@@ -417,15 +476,21 @@ fn exponentiation() -> anyhow::Result<()> {
#[test]
fn comparison_with_zero() -> anyhow::Result<()> {
let compiled = compile! {
debug "
check "
let x = 0 == 0;
let y = 0 < 1;
let z = 0 > -1;
"
};
assert!(
compiled.errors.is_empty(),
"Expected no errors, got: {:?}",
compiled.errors
);
assert_eq!(
compiled,
compiled.output,
indoc! {
"
j main
@@ -446,15 +511,21 @@ fn comparison_with_zero() -> anyhow::Result<()> {
#[test]
fn boolean_negation_edge_cases() -> anyhow::Result<()> {
let compiled = compile! {
debug "
check "
let x = !0;
let y = !1;
let z = !100;
"
};
assert!(
compiled.errors.is_empty(),
"Expected no errors, got: {:?}",
compiled.errors
);
assert_eq!(
compiled,
compiled.output,
indoc! {
"
j main
@@ -475,7 +546,7 @@ fn boolean_negation_edge_cases() -> anyhow::Result<()> {
#[test]
fn function_with_many_parameters() -> anyhow::Result<()> {
let compiled = compile! {
debug "
check "
fn many_params(a, b, c, d, e, f, g, h) {
return a + b + c + d + e + f + g + h;
};
@@ -484,8 +555,14 @@ fn function_with_many_parameters() -> anyhow::Result<()> {
"
};
assert!(
compiled.errors.is_empty(),
"Expected no errors, got: {:?}",
compiled.errors
);
assert_eq!(
compiled,
compiled.output,
indoc! {
"
j main

View File

@@ -5,14 +5,20 @@ use pretty_assertions::assert_eq;
#[test]
fn test_acos() -> Result<()> {
let compiled = compile! {
debug
check
"
let i = acos(123);
"
};
assert!(
compiled.errors.is_empty(),
"Expected no errors, got: {:?}",
compiled.errors
);
assert_eq!(
compiled,
compiled.output,
indoc! {
"
j main
@@ -29,7 +35,7 @@ fn test_acos() -> Result<()> {
#[test]
fn test_asin() -> Result<()> {
let compiled = compile! {
debug
check
"
let i = asin(123);
"
@@ -53,7 +59,7 @@ fn test_asin() -> Result<()> {
#[test]
fn test_atan() -> Result<()> {
let compiled = compile! {
debug
check
"
let i = atan(123);
"
@@ -77,7 +83,7 @@ fn test_atan() -> Result<()> {
#[test]
fn test_atan2() -> Result<()> {
let compiled = compile! {
debug
check
"
let i = atan2(123, 456);
"
@@ -101,7 +107,7 @@ fn test_atan2() -> Result<()> {
#[test]
fn test_abs() -> Result<()> {
let compiled = compile! {
debug
check
"
let i = abs(-123);
"
@@ -125,7 +131,7 @@ fn test_abs() -> Result<()> {
#[test]
fn test_ceil() -> Result<()> {
let compiled = compile! {
debug
check
"
let i = ceil(123.90);
"
@@ -149,7 +155,7 @@ fn test_ceil() -> Result<()> {
#[test]
fn test_cos() -> Result<()> {
let compiled = compile! {
debug
check
"
let i = cos(123);
"
@@ -173,7 +179,7 @@ fn test_cos() -> Result<()> {
#[test]
fn test_floor() -> Result<()> {
let compiled = compile! {
debug
check
"
let i = floor(123);
"
@@ -197,7 +203,7 @@ fn test_floor() -> Result<()> {
#[test]
fn test_log() -> Result<()> {
let compiled = compile! {
debug
check
"
let i = log(123);
"
@@ -221,7 +227,7 @@ fn test_log() -> Result<()> {
#[test]
fn test_max() -> Result<()> {
let compiled = compile! {
debug
check
"
let i = max(123, 456);
"
@@ -245,7 +251,7 @@ fn test_max() -> Result<()> {
#[test]
fn test_max_from_game() -> Result<()> {
let compiled = compile! {
debug
check
r#"
let item = 0;
item = max(1 + 2, 2);
@@ -271,7 +277,7 @@ fn test_max_from_game() -> Result<()> {
#[test]
fn test_min() -> Result<()> {
let compiled = compile! {
debug
check
"
let i = min(123, 456);
"
@@ -295,7 +301,7 @@ fn test_min() -> Result<()> {
#[test]
fn test_rand() -> Result<()> {
let compiled = compile! {
debug
check
"
let i = rand();
"
@@ -319,7 +325,7 @@ fn test_rand() -> Result<()> {
#[test]
fn test_sin() -> Result<()> {
let compiled = compile! {
debug
check
"
let i = sin(3);
"
@@ -343,7 +349,7 @@ fn test_sin() -> Result<()> {
#[test]
fn test_sqrt() -> Result<()> {
let compiled = compile! {
debug
check
"
let i = sqrt(3);
"
@@ -367,7 +373,7 @@ fn test_sqrt() -> Result<()> {
#[test]
fn test_tan() -> Result<()> {
let compiled = compile! {
debug
check
"
let i = tan(3);
"
@@ -391,7 +397,7 @@ fn test_tan() -> Result<()> {
#[test]
fn test_trunc() -> Result<()> {
let compiled = compile! {
debug
check
"
let i = trunc(3.234);
"

View File

@@ -4,13 +4,19 @@ use pretty_assertions::assert_eq;
#[test]
fn simple_negation() -> anyhow::Result<()> {
let compiled = compile! {
debug "
check "
let x = -5;
"
};
assert!(
compiled.errors.is_empty(),
"Expected no errors, got: {:?}",
compiled.errors
);
assert_eq!(
compiled,
compiled.output,
indoc! {
"
j main
@@ -26,14 +32,20 @@ fn simple_negation() -> anyhow::Result<()> {
#[test]
fn negation_of_variable() -> anyhow::Result<()> {
let compiled = compile! {
debug "
check "
let x = 10;
let y = -x;
"
};
assert!(
compiled.errors.is_empty(),
"Expected no errors, got: {:?}",
compiled.errors
);
assert_eq!(
compiled,
compiled.output,
indoc! {
"
j main
@@ -51,13 +63,19 @@ fn negation_of_variable() -> anyhow::Result<()> {
#[test]
fn double_negation() -> anyhow::Result<()> {
let compiled = compile! {
debug "
check "
let x = -(-5);
"
};
assert!(
compiled.errors.is_empty(),
"Expected no errors, got: {:?}",
compiled.errors
);
assert_eq!(
compiled,
compiled.output,
indoc! {
"
j main
@@ -73,13 +91,19 @@ fn double_negation() -> anyhow::Result<()> {
#[test]
fn negation_in_expression() -> anyhow::Result<()> {
let compiled = compile! {
debug "
check "
let x = 10 + (-5);
"
};
assert!(
compiled.errors.is_empty(),
"Expected no errors, got: {:?}",
compiled.errors
);
assert_eq!(
compiled,
compiled.output,
indoc! {
"
j main
@@ -95,13 +119,19 @@ fn negation_in_expression() -> anyhow::Result<()> {
#[test]
fn negation_with_multiplication() -> anyhow::Result<()> {
let compiled = compile! {
debug "
check "
let x = -3 * 4;
"
};
assert!(
compiled.errors.is_empty(),
"Expected no errors, got: {:?}",
compiled.errors
);
assert_eq!(
compiled,
compiled.output,
indoc! {
"
j main
@@ -117,13 +147,19 @@ fn negation_with_multiplication() -> anyhow::Result<()> {
#[test]
fn parentheses_priority() -> anyhow::Result<()> {
let compiled = compile! {
debug "
check "
let x = (2 + 3) * 4;
"
};
assert!(
compiled.errors.is_empty(),
"Expected no errors, got: {:?}",
compiled.errors
);
assert_eq!(
compiled,
compiled.output,
indoc! {
"
j main
@@ -139,13 +175,19 @@ fn parentheses_priority() -> anyhow::Result<()> {
#[test]
fn nested_parentheses() -> anyhow::Result<()> {
let compiled = compile! {
debug "
check "
let x = ((2 + 3) * (4 - 1));
"
};
assert!(
compiled.errors.is_empty(),
"Expected no errors, got: {:?}",
compiled.errors
);
assert_eq!(
compiled,
compiled.output,
indoc! {
"
j main
@@ -161,16 +203,22 @@ fn nested_parentheses() -> anyhow::Result<()> {
#[test]
fn parentheses_with_variables() -> anyhow::Result<()> {
let compiled = compile! {
debug "
check "
let a = 5;
let b = 10;
let c = (a + b) * 2;
"
};
assert!(
compiled.errors.is_empty(),
"Expected no errors, got: {:?}",
compiled.errors
);
// Should calculate (5 + 10) * 2 = 30
assert_eq!(
compiled,
compiled.output,
indoc! {
"
j main
@@ -190,15 +238,21 @@ fn parentheses_with_variables() -> anyhow::Result<()> {
#[test]
fn priority_affects_result() -> anyhow::Result<()> {
let compiled = compile! {
debug "
check "
let with_priority = (2 + 3) * 4;
let without_priority = 2 + 3 * 4;
"
};
assert!(
compiled.errors.is_empty(),
"Expected no errors, got: {:?}",
compiled.errors
);
// with_priority should be 20, without_priority should be 14
assert_eq!(
compiled,
compiled.output,
indoc! {
"
j main
@@ -215,14 +269,20 @@ fn priority_affects_result() -> anyhow::Result<()> {
#[test]
fn negation_of_expression() -> anyhow::Result<()> {
let compiled = compile! {
debug "
check "
let x = -(2 + 3);
"
};
assert!(
compiled.errors.is_empty(),
"Expected no errors, got: {:?}",
compiled.errors
);
// Should be -5 (constant folded)
assert_eq!(
compiled,
compiled.output,
indoc! {
"
j main
@@ -239,14 +299,20 @@ fn negation_of_expression() -> anyhow::Result<()> {
#[test]
fn complex_negation_and_priority() -> anyhow::Result<()> {
let compiled = compile! {
debug "
check "
let x = -((10 - 5) * 2);
"
};
assert!(
compiled.errors.is_empty(),
"Expected no errors, got: {:?}",
compiled.errors
);
// Should be -(5 * 2) = -10 (folded to constant)
assert_eq!(
compiled,
compiled.output,
indoc! {
"
j main
@@ -263,14 +329,20 @@ fn complex_negation_and_priority() -> anyhow::Result<()> {
#[test]
fn negation_in_logical_expression() -> anyhow::Result<()> {
let compiled = compile! {
debug "
check "
let x = !(-5);
"
};
assert!(
compiled.errors.is_empty(),
"Expected no errors, got: {:?}",
compiled.errors
);
// -5 is truthy, so !(-5) should be 0
assert_eq!(
compiled,
compiled.output,
indoc! {
"
j main
@@ -288,14 +360,20 @@ fn negation_in_logical_expression() -> anyhow::Result<()> {
#[test]
fn parentheses_in_comparison() -> anyhow::Result<()> {
let compiled = compile! {
debug "
check "
let x = (10 + 5) > (3 * 4);
"
};
assert!(
compiled.errors.is_empty(),
"Expected no errors, got: {:?}",
compiled.errors
);
// (10 + 5) = 15 > (3 * 4) = 12, so true (1)
assert_eq!(
compiled,
compiled.output,
indoc! {
"
j main

View File

@@ -4,14 +4,20 @@ use pretty_assertions::assert_eq;
#[test]
fn test_yield() -> anyhow::Result<()> {
let compiled = compile! {
debug
check
"
yield();
"
};
assert!(
compiled.errors.is_empty(),
"Expected no errors, got: {:?}",
compiled.errors
);
assert_eq!(
compiled,
compiled.output,
indoc! {
"
j main
@@ -27,7 +33,7 @@ fn test_yield() -> anyhow::Result<()> {
#[test]
fn test_sleep() -> anyhow::Result<()> {
let compiled = compile! {
debug
check
"
sleep(3);
let sleepAmount = 15;
@@ -36,8 +42,14 @@ fn test_sleep() -> anyhow::Result<()> {
"
};
assert!(
compiled.errors.is_empty(),
"Expected no errors, got: {:?}",
compiled.errors
);
assert_eq!(
compiled,
compiled.output,
indoc! {
"
j main
@@ -57,7 +69,7 @@ fn test_sleep() -> anyhow::Result<()> {
#[test]
fn test_set_on_device() -> anyhow::Result<()> {
let compiled = compile! {
debug
check
r#"
device airConditioner = "d0";
let internalTemp = 20c;
@@ -66,8 +78,14 @@ fn test_set_on_device() -> anyhow::Result<()> {
"#
};
assert!(
compiled.errors.is_empty(),
"Expected no errors, got: {:?}",
compiled.errors
);
assert_eq!(
compiled,
compiled.output,
indoc! {
"
j main
@@ -85,15 +103,21 @@ fn test_set_on_device() -> anyhow::Result<()> {
#[test]
fn test_set_on_device_batched() -> anyhow::Result<()> {
let compiled = compile! {
debug
check
r#"
const doorHash = hash("Door");
setBatched(doorHash, "Lock", true);
"#
};
assert!(
compiled.errors.is_empty(),
"Expected no errors, got: {:?}",
compiled.errors
);
assert_eq!(
compiled,
compiled.output,
indoc! {
r#"
j main
@@ -108,7 +132,7 @@ fn test_set_on_device_batched() -> anyhow::Result<()> {
#[test]
fn test_set_on_device_batched_named() -> anyhow::Result<()> {
let compiled = compile! {
debug
check
r#"
device dev = "d0";
const devName = hash("test");
@@ -117,8 +141,14 @@ fn test_set_on_device_batched_named() -> anyhow::Result<()> {
"#
};
assert!(
compiled.errors.is_empty(),
"Expected no errors, got: {:?}",
compiled.errors
);
assert_eq!(
compiled,
compiled.output,
indoc! {
"
j main
@@ -134,7 +164,7 @@ fn test_set_on_device_batched_named() -> anyhow::Result<()> {
#[test]
fn test_load_from_device() -> anyhow::Result<()> {
let compiled = compile! {
debug
check
r#"
device airCon = "d0";
@@ -142,8 +172,14 @@ fn test_load_from_device() -> anyhow::Result<()> {
"#
};
assert!(
compiled.errors.is_empty(),
"Expected no errors, got: {:?}",
compiled.errors
);
assert_eq!(
compiled,
compiled.output,
indoc! {
"
j main
@@ -160,7 +196,7 @@ fn test_load_from_device() -> anyhow::Result<()> {
#[test]
fn test_load_from_slot() -> anyhow::Result<()> {
let compiled = compile! {
debug
check
r#"
device airCon = "d0";
@@ -168,8 +204,14 @@ fn test_load_from_slot() -> anyhow::Result<()> {
"#
};
assert!(
compiled.errors.is_empty(),
"Expected no errors, got: {:?}",
compiled.errors
);
assert_eq!(
compiled,
compiled.output,
indoc! {
"
j main
@@ -186,7 +228,7 @@ fn test_load_from_slot() -> anyhow::Result<()> {
#[test]
fn test_set_slot() -> anyhow::Result<()> {
let compiled = compile! {
debug
check
r#"
device airCon = "d0";
@@ -194,8 +236,14 @@ fn test_set_slot() -> anyhow::Result<()> {
"#
};
assert!(
compiled.errors.is_empty(),
"Expected no errors, got: {:?}",
compiled.errors
);
assert_eq!(
compiled,
compiled.output,
indoc! {
"
j main
@@ -211,7 +259,7 @@ fn test_set_slot() -> anyhow::Result<()> {
#[test]
fn test_load_reagent() -> anyhow::Result<()> {
let compiled = compile! {
debug
check
r#"
device thingy = "d0";
@@ -219,8 +267,14 @@ fn test_load_reagent() -> anyhow::Result<()> {
"#
};
assert!(
compiled.errors.is_empty(),
"Expected no errors, got: {:?}",
compiled.errors
);
assert_eq!(
compiled,
compiled.output,
indoc! {
"
j main