From ca08c29fc510cb722c1767adab56301b73b283f9 Mon Sep 17 00:00:00 2001 From: Tim Vieira Date: Thu, 11 Jul 2013 12:02:29 -0400 Subject: [PATCH] added error test case. --- test/repl/error.dynadoc | 83 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 test/repl/error.dynadoc diff --git a/test/repl/error.dynadoc b/test/repl/error.dynadoc new file mode 100644 index 0000000..09e3e53 --- /dev/null +++ b/test/repl/error.dynadoc @@ -0,0 +1,83 @@ + +> b := 0. +| a += 1/b. +| +| c += "" + b. +| +| e := 0. +| +| b := e/0. +| a += e/0. +| +| d += null. +| d += 1. +| +| a(X) := f(X,Y). +| +| f(1,1) := 1. +| f(1,2) := 2. +| +| f(2,1) := 1. +| f(2,2) := 2. + +Changes +======= +a(1) = $error. +a(2) = $error. +b = 0. +d = $error. +e = 0. +f(1,1) = 1. +f(1,2) = 2. +f(2,1) = 1. +f(2,2) = 2. + +> sol + +Solution +======== +b = 0. +d = $error. +e = 0. + +a/1 +=== +a(1) = $error. +a(2) = $error. + +f/2 +=== +f(1,1) = 1. +f(1,2) = 2. +f(2,1) = 1. +f(2,2) = 2. + +Errors +====== +Error(s) aggregating a/1: + AggregatorError: + `a(2)`: `:=` got conflicting values [1, 2] for rule index 8 + `a(1)`: `:=` got conflicting values [1, 2] for rule index 8 +Error(s) aggregating d/0: + TypeError: + `d`: unsupported operand type(s) for *: 'NoneType' and 'int' +Error(s) in rule: + a += 1/b. + ZeroDivisionError: + when `b` = 0 + division by zero +Error(s) in rule: + c += "" + b. + TypeError: + when `b` = 0 + cannot concatenate 'str' and 'int' objects +Error(s) in rule: + b := e/0. + ZeroDivisionError: + when `e` = 0 + division by zero +Error(s) in rule: + a += e/0. + ZeroDivisionError: + when `e` = 0 + division by zero -- 2.50.1