Last active
August 29, 2015 14:19
-
-
Save bensu/2cc94b8e76bbd695fdc5 to your computer and use it in GitHub Desktop.
Nashorn smaller fail case
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The minimal error (below) disappears when test-919-generic-cas is deleted. It seems to be that the Protocol clashing comes when MyCustomAtom is used, not only defined. The error also disappears if `state` inside MyCustomAtom is changed to snail. Note that Volatile in cljs.core is also defined in terms of a state attribute. | |
Note that even though `compare-and-set!` calls `-deref` it raises no exceptions. | |
ERROR in (test-919-generic-cas) (Error:NaN:NaN) | |
testing CLJS-919, CAS should on custom atom types | |
expected: (== (clojure.core/deref a0) 20) | |
actual: | |
#<Error: No protocol method IDeref.-deref defined for type cljs.core-test/MyCustomAtom: [object Object]> | |
Ran 2 tests containing 2 assertions. | |
0 failures, 1 errors. | |
Tested with 1 out of 4 possible js targets |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns cljs.core-test | |
(:refer-clojure :exclude [iter]) | |
(:require [cljs.test :refer-macros [deftest testing is]])) | |
(deftest test-atoms-and-volatile | |
(let [v (volatile! 1)] | |
(testing "Testing volatile" | |
(is (= 1 (-deref v)))))) | |
(deftype MyCustomAtom [state] | |
IDeref | |
(-deref [_] state)) | |
(deftest test-919-generic-cas | |
(testing "testing CLJS-919, CAS should on custom atom types" | |
(let [a0 (MyCustomAtom. 10)] | |
(is (== (-deref a0) 10))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment