michal-kapala / jitterbit-script

Static typechecker and interpreter for Jitterbit scripts

Home Page:https://npmjs.com/package/jitterbit-script

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

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.