File: defaults_test.clj

package info (click to toggle)
libdynapath-clojure 1.0.0-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, buster, forky, sid, trixie
  • size: 168 kB
  • sloc: xml: 78; makefile: 14; sh: 4
file content (29 lines) | stat: -rw-r--r-- 870 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
(ns dynapath.defaults-test
  (:use clojure.test
        dynapath.defaults
        dynapath.dynamic-classpath)
  (:import (java.net URL URLClassLoader)
           clojure.lang.DynamicClassLoader))

(deftype Frobble [])

(let [foo-url (URL. "http://foo.bar")
      url-cl  (URLClassLoader. (into-array [foo-url]) nil)
      dyn-cl  (DynamicClassLoader.)]
  
  (deftest DynamicClassLoader-should-be-extended
    (is (satisfies? DynamicClasspath dyn-cl)))

  (deftest URLClassLoader-should-be-extended
    (is (satisfies? DynamicClasspath url-cl)))

  (deftest classpath-urls-should-work-for-a-URLClassLoader
    (is (= [foo-url] (classpath-urls url-cl))))

  (deftest add-classpath-url-get-classpath-urls-should-work-for-a-DynamicClassLoader
    (let [url (URL. "http://ham.biscuit")]
      (add-classpath-url dyn-cl url)
      (is (= [url] (classpath-urls dyn-cl))))))