vivid-diff

2021-10-21

Colored object diff viewer.

Upstream URL

github.com/hyotang666/vivid-diff

Author

SATO Shinichi

License

MIT
README
Provided Systems

VIVID-DIFF 2.0.0

What is this?

Colored object diff viewer.

Intended to be used in the test frameworks.

Alternatives and differences.

cl-difflibclos-diffmonkeylib-prose-diffdiffdiff-match-patchvivid-diff
targetsequenceclos-objecttext-filetext-filesequenceany lisp object
outputunix-stylelisthtmlunix-stylelistcolored
patch***

Usage

(let ((expected '(:a :b :c))
      (actual '(:a "b" :c)))
  (diff-print (mismatch-sexp actual expected)))

image of the conses diff.

(let ((expected "Common Lisp is awesome!!")
      (actual   "Common lisp is awesome!!"))
  (diff-print (mismatch-sexp actual expected)))

image of the string diff.

(let ((expected (alexandria:plist-hash-table '(:a "a" :b "b" :c "c")))
      (actual (alexandria:plist-hash-table '(:b :b :c "c" :d "d"))))
  (diff-print (mismatch-sexp actual expected)))

image of the hash-table diff.

As the name shows, MISMATCH-SEXP is for S-Expression, i.e. macroexpanded form. Please note about uninterned symbols are treated as the same as expected. (In corner cases, this behavior may be the pitfall though.)

(let ((expected (macroexpand-1 '(with-open-file (s "path") (read s))))
      (actual (macroexpand-1 '(with-open-file (out "path") (read out)))))
  (diff-print (mismatch-sexp actual expected)))

image of the macroexpanded diff.

From developer

Product's goal

License

MIT

Developed with

SBCL

Tested with

  • SBCL/2.1.7
  • CCL/1.12.1
  • ECL/21.2.1
  • CLISP/2.49
  • Allegro/10.1
  • CMUCL/21D ; See below.
  • ABCL/1.8.0

Known issue

CMUCL

CMUCL pass the test of vivid-diff but vivid-colors that vivid-diff depends on does not support CMUCL.

Installation

Dependencies (6)

  • cl-colors2
  • closer-mop
  • cl-ppcre
  • jingoh
  • matrix-case
  • vivid-colors

Dependents (1)

  • GitHub
  • Quicklisp