-
Notifications
You must be signed in to change notification settings - Fork 72
added support for literal paths in requires #169
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
base: master
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -711,30 +711,32 @@ | |
|
|
||
| (defn resolve | ||
| [from to] | ||
| (let [requirer (split (name from) \.) | ||
| requirement (split (name to) \.) | ||
| relative? (and (not (identical? (name from) | ||
| (name to))) | ||
| (identical? (first requirer) | ||
| (first requirement)))] | ||
| (if relative? | ||
| (loop [from requirer | ||
| to requirement] | ||
| (if (identical? (first from) | ||
| (first to)) | ||
| (recur (rest from) (rest to)) | ||
| (join \/ | ||
| (concat [\.] | ||
| (repeat (dec (count from)) "..") | ||
| to)))) | ||
| (join \/ requirement)))) | ||
| (if (string? to) | ||
| to | ||
| (let [requirer (split (name from) \.) | ||
| requirement (split (name to) \.) | ||
| relative? (and (not (identical? (name from) | ||
| (name to))) | ||
| (identical? (first requirer) | ||
| (first requirement)))] | ||
| (if-not relative? | ||
| (join \/ requirement) | ||
| (loop [from requirer | ||
| to requirement] | ||
| (if (identical? (first from) | ||
| (first to)) | ||
| (recur (rest from) (rest to)) | ||
| (join \/ | ||
| (concat [\.] | ||
| (repeat (dec (count from)) "..") | ||
| to)))))))) | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Indented |
||
|
|
||
| (defn id->ns | ||
| "Takes namespace identifier symbol and translates to new | ||
| symbol without . special characters | ||
| wisp.core -> wisp*core" | ||
| [id] | ||
| (symbol nil (join \* (split (name id) \.)))) | ||
| (symbol nil (join \* (split (name id) #"[./]")))) | ||
|
|
||
|
|
||
| (defn write-require | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| (ns wisp.test.ast | ||
| (:require [wisp.test.util :refe [is thrown?]] | ||
| (:require [wisp.test.util :refer [is thrown?]] | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. …Apparently importing macros does nothing after all?
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah it will import all macros regardless. Intention was to only import ones been referred, but that never made it. |
||
| [wisp.src.reader :refer [read-from-string]] | ||
| [wisp.src.sequence :refer [list]] | ||
| [wisp.src.runtime :refer [str =]] | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -42,8 +42,9 @@ | |
| (do | ||
| (.push *failed* '~form) | ||
| (console.error (str "Fail: " ~msg "\n" | ||
| "expected: " | ||
| (pr-str '~form) "\n" | ||
| "expected: " | ||
| (pr-str '~expected) "\n" | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This way makes it easier to compare long literals. |
||
| " actual: " | ||
| (pr-str (try ~actual (catch error (list 'throw (list 'Error (.-message error)))))))) | ||
| false))))) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed indent here.