# PZ7: Tester has error in assertion

**URL:** <https://forum.codecrafters.io/t/pz7-tester-has-error-in-assertion/8207>\
**Category:** Challenges\
**Tags:** challenge:interpreter\
**Created:** [April 4, 2025, 5:31pm UTC](https://forum.codecrafters.io/t/pz7-tester-has-error-in-assertion/8207 "2025-04-04T17:31:27Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![maximtereshchenko](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/maximtereshchenko/32/3516_2.png) [@maximtereshchenko](https://forum.codecrafters.io/u/maximtereshchenko)\
**Post date:** [April 4, 2025, 5:31pm UTC](https://forum.codecrafters.io/t/pz7-tester-has-error-in-assertion/8207/1 "2025-04-04T17:31:27Z")

</div>

Given from the logs:

```auto
[tester::#PZ7] [test-4.lox] var a = "1";
[tester::#PZ7] [test-4.lox] print a; // Should print 1
[tester::#PZ7] [test-4.lox] 
[tester::#PZ7] [test-4.lox] var a;
[tester::#PZ7] [test-4.lox] print a; // Should print nil
[tester::#PZ7] [test-4.lox] 
[tester::#PZ7] [test-4.lox] var a = "2";
[tester::#PZ7] [test-4.lox] print a; // Should print 2
[tester::#PZ7] [test-4.lox] 
[tester::#PZ7] [test-4.lox] {
[tester::#PZ7] [test-4.lox] // First declaration in local scope
[tester::#PZ7] [test-4.lox] var a = "1";
[tester::#PZ7] [test-4.lox] 
[tester::#PZ7] [test-4.lox] // Attempting to redeclare in local scope
[tester::#PZ7] [test-4.lox] var a = "2"; // This should be a compile error
[tester::#PZ7] [test-4.lox] print a;
[tester::#PZ7] [test-4.lox] }
[tester::#PZ7] [test-4] $ ./your_program.sh run test.lox
[your_program] 1
[your_program] nil
[your_program] 2
[tester::#PZ7] [test-4] 𐄂 1
[tester::#PZ7] [test-4] Expected line #1 on stdout to be "", got "1"
[tester::#PZ7] [test-4] Test failed

```

Tester is appearing to have a mistake asserting the output

---

<div class="post-metadata">

**Author:** ![andy1li](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/andy1li/32/10_2.png) [@andy1li](https://forum.codecrafters.io/u/andy1li)\
**Post date:** [April 4, 2025, 6:12pm UTC](https://forum.codecrafters.io/t/pz7-tester-has-error-in-assertion/8207/4 "2025-04-04T18:12:22Z")

</div>

Hey @maximtereshchenko, stdout should be empty because the test program shouldn’t run at all due to this error:

```auto
[tester::#PZ7] [test-4.lox] // Attempting to redeclare in local scope
[tester::#PZ7] [test-4.lox] var a = "2"; // This should be a compile error

```

---

<div class="post-metadata">

**Author:** ![maximtereshchenko](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/maximtereshchenko/32/3516_2.png) [@maximtereshchenko](https://forum.codecrafters.io/u/maximtereshchenko)\
**Post date:** [April 5, 2025, 8:24am UTC](https://forum.codecrafters.io/t/pz7-tester-has-error-in-assertion/8207/6 "2025-04-05T08:24:10Z")

</div>

OK, I’ve double checked the behaviour with [GitHub - munificent/craftinginterpreters: Repository for the book "Crafting Interpreters"](https://github.com/munificent/craftinginterpreters/tree/master). Indeed, the reference implementation does not print anything. Could I suggest @andy1li not to use comments like `print a; // Should print 1`? It is misleading, and give an impression that it should actually output something

---

<div class="post-metadata">

**Author:** ![ryan-gang](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/ryan-gang/32/38_2.png) [@ryan-gang](https://forum.codecrafters.io/u/ryan-gang)\
**Post date:** [April 5, 2025, 8:51am UTC](https://forum.codecrafters.io/t/pz7-tester-has-error-in-assertion/8207/7 "2025-04-05T08:51:16Z")

</div>

We have fixed the misleading comments in this [PR](https://github.com/codecrafters-io/interpreter-tester/pull/80).  
Thanks for bringing this to our attention!

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex003/uploads/codecrafters/original/3X/7/0/700657133935c15703e22c7c8870394f6e6dc27d.svg) [@system](https://forum.codecrafters.io/u/system)\
**Post date:** [April 10, 2025, 8:51am UTC](https://forum.codecrafters.io/t/pz7-tester-has-error-in-assertion/8207/8 "2025-04-10T08:51:28Z")

</div>

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.
