Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some arity exception message conversion tests failing under Clojure 1.10, 1.11 #791

Closed
lread opened this issue Aug 21, 2022 · 3 comments · Fixed by #793
Closed

Some arity exception message conversion tests failing under Clojure 1.10, 1.11 #791

lread opened this issue Aug 21, 2022 · 3 comments · Fixed by #793

Comments

@lread
Copy link
Contributor

lread commented Aug 21, 2022

version
master HEAD (at the time of this writing 4981762)

platform
jvm

problem
script/test/jvm wants to test against clojure 1.9.0 and then clojure 1.10.2-alpha1, but clojure-1.10.2-alpha1 profile does not exists in project.clj.

During script/test/jvm run you'll see:

Testing with Clojure 1.10.2-alpha1
Warning: profile :clojure-1.10.2-alpha1 not found.

The result, I think, is that we repeat the clojure 1.9.0 test a second time.

next steps
Happy to PR if you let me know what you'd like to do today.

Maybe test against clojure 1.9.0 and clojure 1.11.1?

@borkdude
Copy link
Collaborator

Ah right, yeah fix welcome.

@lread
Copy link
Contributor Author

lread commented Aug 21, 2022

Huh, getting 4 failures against clojure 1.11.1

lein test :only sci.core-test/error-location-test

FAIL in (error-location-test) (core_test.cljc:414)
expected: (sci.test-utils/submap? {:type :sci/error, :line 1, :column 15, :message #"Wrong number of args \(1\) passed to: user/foo"} (try (eval* "(defn foo []) (foo 1)") (catch clojure.lang.ExceptionInfo ex (let [d (ex-data ex)] d))))
  actual: (not (sci.test-utils/submap? {:type :sci/error, :line 1, :column 15, :message #"Wrong number of args \(1\) passed to: user/foo"} {:type :sci/error, :line 1, :column 15, :message "Wrong number of args (1) passed to: function of arity 0", :sci.impl/callstack #object[clojure.lang.Volatile 0x7ff61924 {:status :ready, :val ({:line 1, :column 15, :ns #object[sci.lang.Namespace 0x2164f202 "user"], :file nil, :sci.impl/f-meta {:name foo, :ns #object[sci.lang.Namespace 0x2164f202 "user"], :file nil, :line 1, :column 1, :arglists ([])}} {:line 1, :column 15, :ns #object[sci.lang.Namespace 0x2164f202 "user"], :file nil, :sci.impl/f-meta {:name foo, :ns #object[sci.lang.Namespace 0x2164f202 "user"], :file nil, :line 1, :column 1, :arglists ([])}})}], :file nil}))

lein test :only sci.core-test/error-location-test

FAIL in (error-location-test) (core_test.cljc:420)
expected: (sci.test-utils/submap? {:type :sci/error, :line 1, :column 21, :message #"Wrong number of args \(0\) passed to: user/foo"} (try (eval* "(defn foo [x & xs]) (foo)") (catch clojure.lang.ExceptionInfo ex (let [d (ex-data ex)] d))))
  actual: (not (sci.test-utils/submap? {:type :sci/error, :line 1, :column 21, :message #"Wrong number of args \(0\) passed to: user/foo"} {:type :sci/error, :line 1, :column 21, :message "Wrong number of args (0) passed to: function of arity 1", :sci.impl/callstack #object[clojure.lang.Volatile 0x4473bbc1 {:status :ready, :val ({:line 1, :column 21, :ns #object[sci.lang.Namespace 0x2164f202 "user"], :file nil, :sci.impl/f-meta {:name foo, :ns #object[sci.lang.Namespace 0x2164f202 "user"], :file nil, :line 1, :column 1, :arglists ([x & xs])}} {:line 1, :column 21, :ns #object[sci.lang.Namespace 0x2164f202 "user"], :file nil, :sci.impl/f-meta {:name foo, :ns #object[sci.lang.Namespace 0x2164f202 "user"], :file nil, :line 1, :column 1, :arglists ([x & xs])}})}], :file nil}))

lein test :only sci.core-test/error-location-test

FAIL in (error-location-test) (core_test.cljc:426)
expected: (sci.test-utils/submap? {:type :sci/error, :line 3, :column 12, :message #"Wrong number of args \(2\) passed to: user/bindings"} (try (eval* "\n(defmacro bindings [a] (zipmap (mapv #(list 'quote %) (keys &env)) (keys &env)))\n(let [x 1] (bindings))") (catch clojure.lang.ExceptionInfo ex (let [d (ex-data ex)] d))))
  actual: (not (sci.test-utils/submap? {:type :sci/error, :line 3, :column 12, :message #"Wrong number of args \(2\) passed to: user/bindings"} {:type :sci/error, :line 3, :column 12, :message "Wrong number of args (2) passed to: function of arity 3", :sci.impl/callstack #object[clojure.lang.Volatile 0x55eb9b2c {:status :ready, :val ({:line 3, :column 12, :ns #object[sci.lang.Namespace 0x2164f202 "user"], :file nil, :sci.impl/f-meta {:name bindings, :ns #object[sci.lang.Namespace 0x2164f202 "user"], :file nil, :line 2, :column 1, :arglists ([a]), :macro true}})}], :file nil}))

lein test :only sci.error-test/arity-error-test

FAIL in (arity-error-test) (error_test.cljc:69)
The name of the correct function is reported
expected: (thrown-with-msg? clojure.lang.ExceptionInfo #"Wrong number of args \(0\) passed to: foo/echo-msg" (eval-string "\n(ns foo)\n\n(defn echo-msg [msg]\n  msg)\n\n(ns bar (:require foo))\n\n(defn main []\n  (foo/echo-msg))  ;; called with the wrong arity\n\n(main)"))
  actual: #error {
 :cause "Wrong number of args (0) passed to: sci.impl.fns/fun/arity-1--4161"
 :via
 [{:type clojure.lang.ExceptionInfo
   :message "Wrong number of args (0) passed to: function of arity 1"
   :data {:type :sci/error, :line 10, :column 3, :message "Wrong number of args (0) passed to: function of arity 1", :sci.impl/callstack #object[clojure.lang.Volatile 0x193594ad {:status :ready, :val ({:line 12, :column 1, :ns #object[sci.lang.Namespace 0x1ef50c3b "bar"], :file nil, :sci.impl/f-meta {:name main, :ns #object[sci.lang.Namespace 0x1ef50c3b "bar"], :file nil, :line 9, :column 1, :arglists ([])}} {:line 12, :column 1, :ns #object[sci.lang.Namespace 0x1ef50c3b "bar"], :file nil, :sci.impl/f-meta {:name main, :ns #object[sci.lang.Namespace 0x1ef50c3b "bar"], :file nil, :line 9, :column 1, :arglists ([])}} {:line 10, :column 3, :ns #object[sci.lang.Namespace 0x1ef50c3b "bar"], :file nil, :sci.impl/f-meta {:name echo-msg, :ns #object[sci.lang.Namespace 0x516dd567 "foo"], :file nil, :line 4, :column 1, :arglists ([msg])}})}], :file nil}
   :at [sci.impl.utils$rethrow_with_location_of_node invokeStatic "utils.cljc" 132]}
  {:type clojure.lang.ArityException
   :message "Wrong number of args (0) passed to: sci.impl.fns/fun/arity-1--4161"
   :at [clojure.lang.AFn throwArity "AFn.java" 429]}]
 :trace
 [[clojure.lang.AFn throwArity "AFn.java" 429]
  [clojure.lang.AFn invoke "AFn.java" 28]
  [sci.lang.Var invoke "lang.cljc" 174]
  [sci.impl.analyzer$return_call$reify__5905 eval "analyzer.cljc" 1205]
  [sci.impl.fns$fun$arity_0__4156 invoke "fns.cljc" 105]
  [sci.lang.Var invoke "lang.cljc" 174]
  [sci.impl.analyzer$return_call$reify__5905 eval "analyzer.cljc" 1205]
  [sci.impl.interpreter$eval_form invokeStatic "interpreter.cljc" 39]
  [sci.impl.interpreter$eval_form invoke "interpreter.cljc" 15]
  [sci.impl.interpreter$eval_string_STAR_ invokeStatic "interpreter.cljc" 63]
  [sci.impl.interpreter$eval_string_STAR_ invoke "interpreter.cljc" 56]
  [sci.impl.interpreter$eval_string invokeStatic "interpreter.cljc" 74]
  [sci.impl.interpreter$eval_string invoke "interpreter.cljc" 70]
  [sci.core$eval_string invokeStatic "core.cljc" 239]
  [sci.core$eval_string invoke "core.cljc" 216]
  [sci.core$eval_string invokeStatic "core.cljc" 237]
  [sci.core$eval_string invoke "core.cljc" 216]
  [sci.error_test$fn__9447 invokeStatic "error_test.cljc" 72]
  [sci.error_test$fn__9447 invoke "error_test.cljc" 67]
  [clojure.test$test_var$fn__9856 invoke "test.clj" 717]
  [clojure.test$test_var invokeStatic "test.clj" 717]
  [clojure.test$test_var invoke "test.clj" 708]
  [clojure.test$test_vars$fn__9882$fn__9887 invoke "test.clj" 735]
  [clojure.test$default_fixture invokeStatic "test.clj" 687]
  [clojure.test$default_fixture invoke "test.clj" 683]
  [clojure.test$test_vars$fn__9882 invoke "test.clj" 735]
  [clojure.test$default_fixture invokeStatic "test.clj" 687]
  [clojure.test$default_fixture invoke "test.clj" 683]
  [clojure.test$test_vars invokeStatic "test.clj" 731]
  [clojure.test$test_all_vars invokeStatic "test.clj" 737]
  [clojure.test$test_ns invokeStatic "test.clj" 758]
  [clojure.test$test_ns invoke "test.clj" 743]
  [user$eval227$fn__290 invoke "form-init4271957224264689461.clj" 1]
  [clojure.lang.AFn applyToHelper "AFn.java" 156]
  [clojure.lang.AFn applyTo "AFn.java" 144]
  [clojure.core$apply invokeStatic "core.clj" 669]
  [clojure.core$apply invoke "core.clj" 662]
  [leiningen.core.injected$compose_hooks$fn__154 doInvoke "form-init4271957224264689461.clj" 1]
  [clojure.lang.RestFn applyTo "RestFn.java" 137]
  [clojure.core$apply invokeStatic "core.clj" 667]
  [clojure.core$apply invoke "core.clj" 662]
  [leiningen.core.injected$run_hooks invokeStatic "form-init4271957224264689461.clj" 1]
  [leiningen.core.injected$run_hooks invoke "form-init4271957224264689461.clj" 1]
  [leiningen.core.injected$prepare_for_hooks$fn__159$fn__160 doInvoke "form-init4271957224264689461.clj" 1]
  [clojure.lang.RestFn applyTo "RestFn.java" 137]
  [clojure.lang.AFunction$1 doInvoke "AFunction.java" 31]
  [clojure.lang.RestFn invoke "RestFn.java" 408]
  [clojure.core$map$fn__5935 invoke "core.clj" 2772]
  [clojure.lang.LazySeq sval "LazySeq.java" 42]
  [clojure.lang.LazySeq seq "LazySeq.java" 51]
  [clojure.lang.Cons next "Cons.java" 39]
  [clojure.lang.RT next "RT.java" 713]
  [clojure.core$next__5451 invokeStatic "core.clj" 64]
  [clojure.core$reduce1 invokeStatic "core.clj" 946]
  [clojure.core$reduce1 invokeStatic "core.clj" 936]
  [clojure.core$merge_with invokeStatic "core.clj" 3076]
  [clojure.core$merge_with doInvoke "core.clj" 3068]
  [clojure.lang.RestFn applyTo "RestFn.java" 139]
  [clojure.core$apply invokeStatic "core.clj" 669]
  [clojure.test$run_tests invokeStatic "test.clj" 768]
  [clojure.test$run_tests doInvoke "test.clj" 768]
  [clojure.lang.RestFn applyTo "RestFn.java" 137]
  [clojure.core$apply invokeStatic "core.clj" 667]
  [clojure.core$apply invoke "core.clj" 662]
  [user$eval227$fn__300$fn__333 invoke "form-init4271957224264689461.clj" 1]
  [user$eval227$fn__300$fn__301 invoke "form-init4271957224264689461.clj" 1]
  [user$eval227$fn__300 invoke "form-init4271957224264689461.clj" 1]
  [user$eval227 invokeStatic "form-init4271957224264689461.clj" 1]
  [user$eval227 invoke "form-init4271957224264689461.clj" 1]
  [clojure.lang.Compiler eval "Compiler.java" 7194]
  [clojure.lang.Compiler eval "Compiler.java" 7184]
  [clojure.lang.Compiler load "Compiler.java" 7653]
  [clojure.lang.Compiler loadFile "Compiler.java" 7591]
  [clojure.main$load_script invokeStatic "main.clj" 475]
  [clojure.main$init_opt invokeStatic "main.clj" 477]
  [clojure.main$init_opt invoke "main.clj" 477]
  [clojure.main$initialize invokeStatic "main.clj" 508]
  [clojure.main$null_opt invokeStatic "main.clj" 542]
  [clojure.main$null_opt invoke "main.clj" 539]
  [clojure.main$main invokeStatic "main.clj" 664]
  [clojure.main$main doInvoke "main.clj" 616]
  [clojure.lang.RestFn applyTo "RestFn.java" 137]
  [clojure.lang.Var applyTo "Var.java" 705]
  [clojure.main main "main.java" 40]]}

I'll take a peek, if that's helpful.

@borkdude
Copy link
Collaborator

Thanks for taking a peek in advance!

@lread lread changed the title jvm tests: testing against clojure 1.9.0 twice? Some arity exception message conversion tests failing under Clojure 1.10, 1.11 Aug 21, 2022
lread added a commit to lread/sci that referenced this issue Aug 21, 2022
We were almost taking into account the `sci.impl.` fn name prefix that
shows up in Clojure 1.10+, but not quite.
Now also only applying arity conversion code to arity exception messages.

We were previously accidentally only testing against Clojure 1.9.0, so
these test failures went unnoticed.

Fixes babashka#791
borkdude pushed a commit that referenced this issue Aug 22, 2022
We were almost taking into account the `sci.impl.` fn name prefix that
shows up in Clojure 1.10+, but not quite.
Now also only applying arity conversion code to arity exception messages.

We were previously accidentally only testing against Clojure 1.9.0, so
these test failures went unnoticed.

Fixes #791
lread added a commit to lread/sci that referenced this issue Aug 24, 2022
* master:
  Fix babashka#791: arity exception msgs for Clojure 1.10, 1.11 (babashka#793)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants