brandonbloom / fipp

Fast Idiomatic Pretty Printer for Clojure
525 stars 44 forks source link

clojurescript tests failing #67

Closed lread closed 4 years ago

lread commented 4 years ago

Hiya!

While preparing to work on #66, I wanted to make sure all tests pass first.

So I ran what seemed to make sense:

  1. clojure tests - lein test
  2. benchmark - lein run -m fipp.benchmark
  3. clojurescript tests - ./test.sh

The first 2 succeeded but the clojurescript tests showed 4 failures:

FAIL in (pprint-edn) (cljs/test.js:431:14)
Pretty printing Edn without metadata
expected: (= (clean (with-out-str (pprint data {:width 70}))) wide)
  actual: (not (= "[(1 2 3 4 [:a :b :c :d] 5 6 7 8 9)\n {:foo 1, :bar \"c\", :baz \"str\"}\n {:small-value [1 2 3],\n  :larger-value {:some-key \"foo\", :some-other-key \"bar\"}}\n #fipp.edn_test.Person{:first-name \"Brandon\", :last-name \"Bloom\"}\n #x 5\n #object[clojure.core.Atom\n         {:status :ready,\n          :val (0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19)}]\n #object[clojure.core$future_call$reify__123\n         \"0xDEADBEEF\"\n         {:status :ready, :val 1}]\n #{:baz :bar :foo}]" "[(1 2 3 4 [:a :b :c :d] 5 6 7 8 9)\n {:foo 1, :bar \\c, :baz \"str\"}\n {:small-value [1 2 3],\n  :larger-value {:some-key \"foo\", :some-other-key \"bar\"}}\n #fipp.edn_test.Person{:first-name \"Brandon\", :last-name \"Bloom\"}\n #x 5\n #object[clojure.lang.Atom\n         \"0xDEADBEEF\"\n         {:status :ready,\n          :val (0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19)}]\n #object[clojure.core$future_call$reify__123\n         \"0xDEADBEEF\"\n         {:status :ready, :val 1}]\n #{:baz :bar :foo}]"))

FAIL in (pprint-edn) (cljs/test.js:431:14)
Pretty printing Edn without metadata
expected: (= (clean (with-out-str (pprint data {:width 30}))) narrow)
  actual: (not (= "[(1\n  2\n  3\n  4\n  [:a :b :c :d]\n  5\n  6\n  7\n  8\n  9)\n {:foo 1,\n  :bar \"c\",\n  :baz \"str\"}\n {:small-value [1 2 3],\n  :larger-value {:some-key \"foo\",\n                 :some-other-key \"bar\"}}\n #fipp.edn_test.Person{:first-name \"Brandon\",\n                       :last-name \"Bloom\"}\n #x 5\n #object[clojure.core.Atom\n         {:status :ready,\n          :val (0\n                1\n                2\n                3\n                4\n                5\n                6\n                7\n                8\n                9\n                10\n                11\n                12\n                13\n                14\n                15\n                16\n                17\n                18\n                19)}]\n #object[clojure.core$future_call$reify__123\n         \"0xDEADBEEF\"\n         {:status :ready,\n          :val 1}]\n #{:baz :bar :foo}]" "[(1\n  2\n  3\n  4\n  [:a :b :c :d]\n  5\n  6\n  7\n  8\n  9)\n {:foo 1, :bar \\c, :baz \"str\"}\n {:small-value [1 2 3],\n  :larger-value {:some-key \"foo\",\n                 :some-other-key \"bar\"}}\n #fipp.edn_test.Person{:first-name \"Brandon\",\n                       :last-name \"Bloom\"}\n #x 5\n #object[clojure.lang.Atom\n         \"0xDEADBEEF\"\n         {:status :ready,\n          :val (0\n                1\n                2\n                3\n                4\n                5\n                6\n                7\n                8\n                9\n                10\n                11\n                12\n                13\n                14\n                15\n                16\n                17\n                18\n                19)}]\n #object[clojure.core$future_call$reify__123\n         \"0xDEADBEEF\"\n         {:status :ready,\n          :val 1}]\n #{:baz :bar :foo}]"))

FAIL in (pprint-edn) (cljs/test.js:431:14)
Not quite Edn
expected: (= (with-out-str (pprint (var inc))) "#'clojure.core/inc\n")
  actual: (not (= "#'cljs.core/inc\n" "#'clojure.core/inc\n"))

Testing fipp.clojure-test

FAIL in (meta-test) (cljs/test.js:431:14)
metadata is omitted from identities
expected: (= (clean (with-out-str (pprint [(var inc) (with-meta (quote x) {:y 1})] {:print-meta true}))) "[#'clojure.core/inc ^{:y 1} x]")
  actual: (not (= "[#'clojure.core.inc ^{:y 1} x]" "[#'clojure.core/inc ^{:y 1} x]"))

Ran 11 tests containing 56 assertions.
4 failures, 0 errors.

I am happy to look into these if that would be helpful.

brandonbloom commented 4 years ago

The cljs tests are very brittle because the printing format was in flux for a while. I fixed them up in a938b6c. Thanks for the heads up.

lread commented 4 years ago

Thanks!