Skip to content
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

Fix missing import in doc macro expansion #1679

Merged
merged 1 commit into from
Sep 24, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions hy/core/macros.hy
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
;;; These macros form the hy language
;;; They are automatically required in every module, except inside hy.core

(import [importlib [import-module]])

(import [hy.models [HyList HySymbol]])

(defmacro as-> [head name &rest rest]
Expand Down Expand Up @@ -248,6 +246,7 @@ Such 'o!' params are available within `body` as the equivalent 'g!' symbol."
Use ``#doc foo`` instead for help with tag macro ``#foo``.
Use ``(help foo)`` instead for help with runtime objects."
`(try
(import [importlib [import-module]])
(help (. (import-module "hy")
macros
_hy_macros
Expand All @@ -265,6 +264,7 @@ Such 'o!' params are available within `body` as the equivalent 'g!' symbol."

Gets help for a tag macro function available in this module."
`(try
(import [importlib [import-module]])
(help (. (import-module "hy")
macros
_hy_tag
Expand Down
7 changes: 7 additions & 0 deletions tests/native_tests/core.hy
Original file line number Diff line number Diff line change
Expand Up @@ -682,3 +682,10 @@ result['y in globals'] = 'y' in globals()")
(defn test-comment []
(assert-none (comment <h1>This is merely a comment.</h1>
<p> Move along. (Nothing to see here.)</p>)))

(defn test-doc [capsys]
(doc doc)
(setv out_err (.readouterr capsys))
(assert (.startswith (.strip (first out_err))
"Help on function (doc) in module hy.core.macros:"))
(assert (empty? (second out_err))))