Back

load-script (clj)

(source)

function

(load-script path)
Loads Clojure source from a file or resource given its path. Paths beginning with @ or @/ are considered relative to classpath.

Examples

clojure/core.typed
(deftest demunge-test
  (is-tc-e (demunge "abc") String 
           :requires [[clojure.main :refer [demunge]]])
  (is-tc-err (demunge "abc") Boolean
             :requires [[clojure.main :refer [demunge]]])
  (is-tc-err (demunge 1) String 
             :requires [[clojure.main :refer [demunge]]]))

(deftest main-test
  (is-tc-e #(main)
           :requires [[clojure.main :refer [main]]])
  (is-tc-e #(main "foo")
           :requires [[clojure.main :refer [main]]]))
           
(deftest load-script-test
  (is-tc-e #(load-script "sample.clj")
           :requires [[clojure.main :refer [load-script]]])
  (is-tc-err #(load-script 1)
             :requires [[clojure.main :refer [load-script]]]))
typedclojure/typedclojure
(deftest demunge-test
  (is-tc-e (demunge "abc") String 
           :requires [[clojure.main :refer [demunge]]])
  (is-tc-err (demunge "abc") Boolean
             :requires [[clojure.main :refer [demunge]]])
  (is-tc-err (demunge 1) String 
             :requires [[clojure.main :refer [demunge]]]))

(deftest main-test
  (is-tc-e #(main)
           :requires [[clojure.main :refer [main]]])
  (is-tc-e #(main "foo")
           :requires [[clojure.main :refer [main]]]))
           
(deftest load-script-test
  (is-tc-e #(load-script "sample.clj")
           :requires [[clojure.main :refer [load-script]]])
  (is-tc-err #(load-script 1)
             :requires [[clojure.main :refer [load-script]]]))
reborg/clojure-essential-reference
(require '[clojure.main :as main]) ; <1>

(main/load-script "@clojure/core/reducers.clj") ; <3>
reborg/clojure-essential-reference
(require '[clojure.main :as main])

(main/load-script "hello.exe") ; <2>
;; "Hello World!"
;; nil