From 089b23bffa4b164ba19b7ce08348bc971072b3bf Mon Sep 17 00:00:00 2001 From: Thomas Mulvaney Date: Fri, 15 Jan 2016 12:22:05 +0000 Subject: [PATCH 1/2] remove in-ns related code. --- pixie/vm/compiler.py | 8 -------- tests/pixie/tests/test-stdlib.pxi | 19 ------------------- 2 files changed, 27 deletions(-) diff --git a/pixie/vm/compiler.py b/pixie/vm/compiler.py index 5d0f214f..4d1dab58 100644 --- a/pixie/vm/compiler.py +++ b/pixie/vm/compiler.py @@ -759,13 +759,6 @@ def compile_yield(form, ctx): compile_form(arg, ctx) ctx.bytecode.append(code.YIELD) -def compile_in_ns(form, ctx): - affirm(rt.count(form) == 2, u"in-ns requires an argument") - arg = rt.first(rt.next(form)) - NS_VAR.set_value(code._ns_registry.find_or_make(rt.name(arg))) - NS_VAR.deref().include_stdlib() - compile_fn_call(form, ctx) - def compile_local_macro(form, ctx): form = rt.next(form) binding = rt.first(form) @@ -799,7 +792,6 @@ def compile_local_macro(form, ctx): u"var": compile_var, u"catch": compile_catch, u"this-ns-name": compile_this_ns, - u"in-ns": compile_in_ns, # yes, this is both a function and a compiler special form. u"yield": compile_yield, u"local-macro": compile_local_macro} diff --git a/tests/pixie/tests/test-stdlib.pxi b/tests/pixie/tests/test-stdlib.pxi index 12ad9912..813b9a6a 100644 --- a/tests/pixie/tests/test-stdlib.pxi +++ b/tests/pixie/tests/test-stdlib.pxi @@ -485,25 +485,6 @@ '(0 1 2 3 4 5 6 7 8 9)) true)) -(t/deftest test-ns - ;; Create a namespace called foo - (in-ns :foo) - (def bar :humbug) - (defn baz [x y] (+ x y)) - ;; Back into the text namespace - (in-ns :pixie.tests.test-stdlib) - (t/assert= (set (keys (ns-map 'foo))) - #{'bar 'baz})) - -(t/deftest test-ns-aliases - (in-ns :ns-to-require) - (in-ns :my-fake-ns) - (require ns-to-require :as some-alias) - (in-ns :pixie.tests.test-stdlib) - (t/assert= {'some-alias (the-ns 'ns-to-require) - 'pixie.stdlib (the-ns 'pixie.stdlib)} - (ns-aliases (the-ns 'my-fake-ns)))) - (t/deftest test-while (t/assert= (while (pos? 0) true ) nil) (t/assert= (while (pos? 0) false) nil) From 51598abad6f74273c16d3cf9c13e35290c1d3c18 Mon Sep 17 00:00:00 2001 From: Thomas Mulvaney Date: Sun, 6 Mar 2016 14:07:14 +0000 Subject: [PATCH 2/2] make tests work --- tests/pixie/tests/test-stdlib.pxi | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/tests/pixie/tests/test-stdlib.pxi b/tests/pixie/tests/test-stdlib.pxi index 813b9a6a..da70caa2 100644 --- a/tests/pixie/tests/test-stdlib.pxi +++ b/tests/pixie/tests/test-stdlib.pxi @@ -485,6 +485,26 @@ '(0 1 2 3 4 5 6 7 8 9)) true)) +(t/deftest test-ns + ;; Create a namespace called foo + (in-ns :foo) + (eval '(def bar :humbug)) + (eval '(defn baz [x y] (+ x y))) + ;; Back into the text namespace + (in-ns :pixie.tests.test-stdlib) + (t/assert= (set (keys (ns-map 'foo))) + #{'bar 'baz})) + +(t/deftest test-ns-aliases + (in-ns :ns-to-require) + (in-ns :my-fake-ns) + (require ns-to-require :as some-alias) + (in-ns :pixie.tests.test-stdlib) + (t/assert= {'some-alias (the-ns 'ns-to-require) + 'pixie.stdlib (the-ns 'pixie.stdlib)} + (ns-aliases (the-ns 'my-fake-ns)))) + + (t/deftest test-while (t/assert= (while (pos? 0) true ) nil) (t/assert= (while (pos? 0) false) nil) @@ -674,6 +694,7 @@ (t/assert-throws? RuntimeException "proto must be a Protocol" (satisfies? [IIndexed :also-not-a-proto] [1 2])) + (in-ns :pixie.tests.test-stdlib) (defprotocol IFoo (foo [this])) (extend-protocol IFoo Number