ballercat / walt

:zap: Walt is a JavaScript-like syntax for WebAssembly text format :zap:

Home Page:https://ballercat.github.io/walt/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add binary debug snapshot to compiler specs

ballercat opened this issue · comments

Goal

Improve DX, make testing easier and more stable.

Overview

There are currently a ton of tests ~200. The most useful so far are ones at the entire compiler level. These integration-like tests are good for catching breaks in logic while developing new features. However, it's hard to track down what is actually wrong in the final binary output. Most issues show up as off-by-one errors in the binary, like wrong type indexes or function indexes. While refactoring the parser I found myself using online diff tools to figure out the issues. We might as well use the built-in snapshot in ava to do the same thing.

Acceptance Criteria

This is a pure addition to specs and does not require new logic in the compiler.

  • Add snapshots to all existing full compiler specs.

See docs source-code for example use of debug function

const wasm = debugWalt(this.intermediateRepresentation);