From a39197af621a65f42bd669e3d9535f1fc9f7fac6 Mon Sep 17 00:00:00 2001 From: damirka Date: Thu, 6 May 2021 14:52:20 +0300 Subject: [PATCH] add const test --- tests/compiler/statements/ternary_non_const_fail.leo | 9 +++++++++ .../compiler/statements/ternary_non_const_fail.leo.out | 5 +++++ 2 files changed, 14 insertions(+) create mode 100644 tests/compiler/statements/ternary_non_const_fail.leo create mode 100644 tests/expectations/compiler/compiler/statements/ternary_non_const_fail.leo.out diff --git a/tests/compiler/statements/ternary_non_const_fail.leo b/tests/compiler/statements/ternary_non_const_fail.leo new file mode 100644 index 0000000000..4f1638e00a --- /dev/null +++ b/tests/compiler/statements/ternary_non_const_fail.leo @@ -0,0 +1,9 @@ +/* +namespace: Compile +expectation: Fail +*/ + +function main() { + let x = 3u8; + const y = x > 2u8? 1u8 : 2u8; +} diff --git a/tests/expectations/compiler/compiler/statements/ternary_non_const_fail.leo.out b/tests/expectations/compiler/compiler/statements/ternary_non_const_fail.leo.out new file mode 100644 index 0000000000..fe2b77a905 --- /dev/null +++ b/tests/expectations/compiler/compiler/statements/ternary_non_const_fail.leo.out @@ -0,0 +1,5 @@ +--- +namespace: Compile +expectation: Fail +outputs: + - " --> /Users/dam/projects/aleo/leo/test-framework/../tests/compiler/statements/ternary_non_const_fail.leo:5:5\n |\n 5 | const y = x > 2u8? 1u8 : 2u8;\n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n |\n = failed to create const variable(s) 'y' with non constant values."