diff --git a/compiler/compiler/tests/execute.rs b/compiler/compiler/tests/execute.rs index 9ab4e699be..20e3bc198a 100644 --- a/compiler/compiler/tests/execute.rs +++ b/compiler/compiler/tests/execute.rs @@ -157,15 +157,17 @@ fn run_test(test: Test, handler: &Handler, err_buf: &BufferEmitter) -> Result::from_str(input.as_str().unwrap()).unwrap()) .collect(); let input_string = format!("[{}]", inputs.iter().map(|input| input.to_string()).join(", ")); + let private_key = match case.get(&Value::from("private_key")) { + Some(private_key) => { + PrivateKey::from_str(private_key.as_str().expect("expected string for private key")) + .expect("unable to parse private key") + } + None => dotenv_private_key(package.directory()).unwrap(), + }; // TODO: Add support for custom config like custom private keys. // Execute the program and get the outputs. - let output_string = match package.run::( - &dotenv_private_key(package.directory()).unwrap(), - function_name, - &inputs, - rng, - ) { + let output_string = match package.run::(&private_key, function_name, &inputs, rng) { Ok((response, _)) => format!( "[{}]", response diff --git a/tests/expectations/execution/counter.out b/tests/expectations/execution/counter.out index 05fd1b100f..a2d7e0e2fc 100644 --- a/tests/expectations/execution/counter.out +++ b/tests/expectations/execution/counter.out @@ -16,10 +16,10 @@ outputs: results: dubble: - input: "[]" - output: "[{\n program_id: test.aleo,\n function_name: dubble,\n arguments: [\n aleo1ujk4sm9yqm49au0jw36freu2k5pzvfeut4hymuxxxwxqmztndc8qgfyjwy\n ]\n}]" + output: "[{\n program_id: test.aleo,\n function_name: dubble,\n arguments: [\n aleo17z49cl3wfpjdyu5juxaxnuttag24ygz36pg8ln2qmlcsw4w8cs9s3f45uq\n ]\n}]" - input: "[]" - output: "[{\n program_id: test.aleo,\n function_name: dubble,\n arguments: [\n aleo1ujk4sm9yqm49au0jw36freu2k5pzvfeut4hymuxxxwxqmztndc8qgfyjwy\n ]\n}]" + output: "[{\n program_id: test.aleo,\n function_name: dubble,\n arguments: [\n aleo17z49cl3wfpjdyu5juxaxnuttag24ygz36pg8ln2qmlcsw4w8cs9s3f45uq\n ]\n}]" - input: "[]" - output: "[{\n program_id: test.aleo,\n function_name: dubble,\n arguments: [\n aleo1ujk4sm9yqm49au0jw36freu2k5pzvfeut4hymuxxxwxqmztndc8qgfyjwy\n ]\n}]" + output: "[{\n program_id: test.aleo,\n function_name: dubble,\n arguments: [\n aleo17z49cl3wfpjdyu5juxaxnuttag24ygz36pg8ln2qmlcsw4w8cs9s3f45uq\n ]\n}]" - input: "[]" - output: "[{\n program_id: test.aleo,\n function_name: dubble,\n arguments: [\n aleo1ujk4sm9yqm49au0jw36freu2k5pzvfeut4hymuxxxwxqmztndc8qgfyjwy\n ]\n}]" + output: "[{\n program_id: test.aleo,\n function_name: dubble,\n arguments: [\n aleo17z49cl3wfpjdyu5juxaxnuttag24ygz36pg8ln2qmlcsw4w8cs9s3f45uq\n ]\n}]" diff --git a/tests/tests/execution/counter.leo b/tests/tests/execution/counter.leo index a9bf637acc..6c7360c3de 100644 --- a/tests/tests/execution/counter.leo +++ b/tests/tests/execution/counter.leo @@ -6,9 +6,13 @@ initial_state: cases: dubble: - input: [] + private_key: APrivateKey1zkpH5Ne1Xfd79t61VhK7b6yaYz92yW5dbuVkiFheR7rwCDE - input: [] + private_key: APrivateKey1zkpH5Ne1Xfd79t61VhK7b6yaYz92yW5dbuVkiFheR7rwCDE - input: [] + private_key: APrivateKey1zkpH5Ne1Xfd79t61VhK7b6yaYz92yW5dbuVkiFheR7rwCDE - input: [] + private_key: APrivateKey1zkpH5Ne1Xfd79t61VhK7b6yaYz92yW5dbuVkiFheR7rwCDE */ program test.aleo {