harness

package
v0.2.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 29, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package harness compares this compiler's output against the reference implementation, babel-preset-solid.

The two agree on semantics but not on spelling, so comparison is layered: templates, the helper set, and the delegated event set must match exactly; statement bodies are compared after normalizing generated variable names, equivalent accessor forms, and DOM navigation paths.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NormalizeBody

func NormalizeBody(src string) string

NormalizeBody reduces generated code to a form where only meaningful differences remain: generated variables are alpha-renamed, equivalent accessor spellings are collapsed, comments and whitespace are removed, and DOM navigation is expanded to root-relative paths.

Types

type Mismatch

type Mismatch struct {
	// Kind is "template", "helpers", "events", or "body".
	Kind      string
	Reference string
	Actual    string
	Detail    string
}

Mismatch is a single difference, categorized as "template", "helpers", "events", or "body".

type Output

type Output struct {
	// Templates are the hoisted HTML strings, in declaration order, with
	// template-literal escaping removed.
	Templates []string
	// Helpers are the runtime helpers imported, sorted.
	Helpers []string
	// Delegated are the event names registered for delegation, sorted.
	Delegated []string
	// Body is everything else, normalized.
	Body string
}

Output is the structured content extracted from a generated module.

func Extract

func Extract(src string) Output

Extract parses a generated module into its comparable parts.

type Report

type Report struct {
	Name       string
	Mismatches []Mismatch
}

Report describes how one fixture's output differs from the reference.

func Compare

func Compare(name, reference, actual string) Report

Compare checks generated output against the reference.

func (Report) OK

func (r Report) OK() bool

OK reports whether the outputs agree.

func (Report) String

func (r Report) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL