paritytest

package
v0.10.2 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package paritytest compares codegrapher output against golden outputs captured from the original codegraph CLI (testdata/golden), implementing the normalization rules documented in tools/parity/README.md:

  • machine-specific fields are replaced with "<NORM>"
  • arrays whose order is not functionally meaningful are sorted
  • object keys compare order-insensitively (canonical JSON)
  • query[] result order IS meaningful (descending score) and is preserved

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Canonicalize

func Canonicalize(raw []byte, topLevelUnordered bool) ([]byte, error)

Canonicalize parses raw JSON and returns its normalized, deterministically ordered re-encoding. topLevelUnordered marks the whole top-level array as order-insensitive (e.g. the files verb); query results keep their order.

func Diff

func Diff(goldenPath string, got []byte, topLevelUnordered bool) (string, error)

Diff compares got against the golden file at goldenPath after canonicalizing both sides. It returns "" when equivalent, else a human-readable mismatch.

Types

This section is empty.

Jump to

Keyboard shortcuts

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