Created
May 14, 2012 18:48
-
-
Save MichaelDrogalis/2695642 to your computer and use it in GitHub Desktop.
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 clojure-distance.test.core | |
(:use [clojure.test]) | |
(:require clojure-distance.core) | |
(:import [clojure-distance.core Miles])) | |
(deftest miles-to-miles | |
(is | |
(= (to-miles (Miles. 5)) 5) | |
"Converting miles to miles returned a different length.")) | |
(deftest miles-to-km | |
(is | |
(= (to-km (Miles. 1)) 1.609) | |
"Converting miles to kilometers failed.")) |
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 clojure-distance.core) | |
(defprotocol Convertable | |
(to-miles [this]) | |
(to-km [this])) | |
(defrecord Miles [length] | |
Convertable | |
(to-miles [this] :length) | |
(to-km [this] (* :length 1.609))) |
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
C:\Users\XPherior\Desktop\clojure-distance>lein test | |
Exception in thread "main" java.lang.ClassNotFoundException: clojure-distance.core.Miles (core.clj:1) | |
at clojure.lang.Compiler.eval(Compiler.java:5440) | |
at clojure.lang.Compiler.eval(Compiler.java:5415) | |
at clojure.lang.Compiler.load(Compiler.java:5857) | |
at clojure.lang.RT.loadResourceScript(RT.java:340) | |
at clojure.lang.RT.loadResourceScript(RT.java:331) | |
at clojure.lang.RT.load(RT.java:409) | |
at clojure.lang.RT.load(RT.java:381) | |
at clojure.core$load$fn__4519.invoke(core.clj:4915) | |
at clojure.core$load.doInvoke(core.clj:4914) | |
at clojure.lang.RestFn.invoke(RestFn.java:408) | |
at clojure.core$load_one.invoke(core.clj:4729) | |
at clojure.core$load_lib.doInvoke(core.clj:4766) | |
at clojure.lang.RestFn.applyTo(RestFn.java:142) | |
at clojure.core$apply.invoke(core.clj:542) | |
at clojure.core$load_libs.doInvoke(core.clj:4800) | |
at clojure.lang.RestFn.applyTo(RestFn.java:137) | |
at clojure.core$apply.invoke(core.clj:542) | |
at clojure.core$require.doInvoke(core.clj:4881) | |
at clojure.lang.RestFn.invoke(RestFn.java:421) | |
at user$eval9.invoke(NO_SOURCE_FILE:1) | |
at clojure.lang.Compiler.eval(Compiler.java:5424) | |
at clojure.lang.Compiler.eval(Compiler.java:5414) | |
at clojure.lang.Compiler.eval(Compiler.java:5415) | |
at clojure.lang.Compiler.eval(Compiler.java:5391) | |
at clojure.core$eval.invoke(core.clj:2382) | |
at clojure.main$eval_opt.invoke(main.clj:235) | |
at clojure.main$initialize.invoke(main.clj:254) | |
at clojure.main$null_opt.invoke(main.clj:279) | |
at clojure.main$main.doInvoke(main.clj:354) | |
at clojure.lang.RestFn.invoke(RestFn.java:421) | |
at clojure.lang.Var.invoke(Var.java:369) | |
at clojure.lang.AFn.applyToHelper(AFn.java:163) | |
at clojure.lang.Var.applyTo(Var.java:482) | |
at clojure.main.main(main.java:37) | |
Caused by: java.lang.ClassNotFoundException: clojure-distance.core.Miles | |
at java.net.URLClassLoader$1.run(Unknown Source) | |
at java.security.AccessController.doPrivileged(Native Method) | |
at java.net.URLClassLoader.findClass(Unknown Source) | |
at clojure.lang.DynamicClassLoader.findClass(DynamicClassLoader.java:61) | |
at java.lang.ClassLoader.loadClass(Unknown Source) | |
at java.lang.ClassLoader.loadClass(Unknown Source) | |
at java.lang.Class.forName0(Native Method) | |
at java.lang.Class.forName(Unknown Source) | |
at clojure_distance.test.core$eval17$loading__4414__auto____18.invoke(core.clj:1) | |
at clojure_distance.test.core$eval17.invoke(core.clj:1) | |
at clojure.lang.Compiler.eval(Compiler.java:5424) | |
... 33 more |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment