unit tests
michal-kapala opened this issue · comments
Unit tests for each of the modules are a must before #1
Lexer
- tokenization unit tests
Parser
- AST validation unit tests
- error handling tests (behaviour diff between typechecker/runtime)
Typechecker
- selective AST validation (types, errors and warnings)
- typical mid-typing error handling
Runtime
Type suites
-
JbNumber
-
JbBool
-
JbString
-
JbNull
-
JbArray
-
JbDictionary
-
JbBinary
-
JbDate
Function module suites
- cache
- conversion
- crypto
- database
- datetime
- debug
- dict/array
- diff
- env info
- file
- general
- instance
- LDAP
- log/error
- logical
- math
- NetSuite
- Salesforce
- string
- text
- XML
System variable suites
- initialization
Interpreter E2E
- real-life script suite (lexer + parser + runtime)
Typechecker E2E
- real-life script suite (lexer + parser + typechecker)
Approach
Operators
Operator tests should include every possible type combination:
- every pair of types for assignments and binary operators
- each of 8 available types for unary operators
Functions
Similarly, every supported function implementation should have tests for every argument type combination, including the optional arguments if available. Additionally, edge case values with unexpected conversions should be covered.
QA suite
While other unit tests should be short and of single responsibility, a suite of longer real-life scripts should be created to detect complex bugs/issues. Coverage limits for these are to be defined later.
Closed by c4ecc44