Skip to content

Commit

Permalink
Add test case to check that lhs isn't undefined
Browse files Browse the repository at this point in the history
  • Loading branch information
melvic-ybanez committed Oct 26, 2023
1 parent 4596d2e commit 4aeb680
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/test/scala/com/melvic/dry/tests/ParserSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import org.scalatest.matchers.should
import org.scalatestplus.scalacheck.ScalaCheckPropertyChecks

/**
* Houses the test cases for the parsing phase that are difficult to implement using Dry's tests (because the
* Houses the test cases for the parsing phase that are difficult to implement in Dry (because the
* parser would fail in the first place).
*
* Note: many of the test cases here are based on the lox test suite:
Expand Down
8 changes: 8 additions & 0 deletions tests/test_assignment.dry
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,19 @@ def test_associativity() {
def test_rhs() {
let a = "before";
let c = a = "after";

assert_equal("a = 'after'", a, "after");
assert_equal("c = 'after'", c, "after");
}

def test_lhs() {
assert_error("rhs should not be an undefined variable", Errors.UNDEFINED_VARIABLE,
lambda() { unknown = "what"; });
}

test_associativity();
test_rhs();
test_lhs();

// global
let a = "before";
Expand Down

0 comments on commit 4aeb680

Please sign in to comment.