Skip to content

Commit ef4e430

Browse files
committed
adding tests
1 parent 79d3033 commit ef4e430

28 files changed

Lines changed: 384 additions & 277 deletions
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Subprocess failed (exit code: 1)

config/packages.edn

Lines changed: 43 additions & 103 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,8 @@
1-
{xyz.zcaudate/code.ai
2-
{:description "ai client and server"
3-
:include [[code.ai.heal :complete]
4-
[code.ai.server :complete]]
5-
:dependencies [org.hugoduncan/mcp-clj-server]}
6-
7-
xyz.zcaudate/code.mcp
1+
{xyz.zcaudate/code.mcp
82
{:description "java-sdk MCP wrappers and RAG scaffolding"
93
:include [[code.mcp :complete]]
104
:dependencies [io.modelcontextprotocol.sdk/mcp]}
115

12-
xyz.zcaudate/code.dev
13-
{:description "generate documentation from code"
14-
:include [[code.dev :complete]]}
15-
166
xyz.zcaudate/code.doc
177
{:description "generate documentation from code"
188
:include [[code.doc :complete]]
@@ -23,24 +13,11 @@
2313
{:description "source and test management"
2414
:include [[code.framework :complete]]}
2515

26-
xyz.zcaudate/code.java
27-
{:description "source and test management"
28-
:include [[code.java :complete]]
29-
:dependencies [org.ow2.asm/asm]}
30-
31-
xyz.zcaudate/code.link
32-
{:description "code packaging and distribution"
33-
:include [[code.link :complete]]}
34-
3516
xyz.zcaudate/code.manage
3617
{:description "source code utils and workflow"
3718
:include [[code.manage :complete]]
3819
:bundle [{:path "resources" :include ["assets/code.manage"]}]}
3920

40-
xyz.zcaudate/code.maven
41-
{:description "code packaging and distribution"
42-
:include [[code.maven :complete]]}
43-
4421
xyz.zcaudate/code.project
4522
{:description "working with projects"
4623
:include [[code.project :complete]]}
@@ -387,75 +364,28 @@
387364
{:description "python libs and helpers"
388365
:include [[python :complete]]}
389366

390-
xyz.zcaudate/rt.base
391-
{:description "base runtimes"
392-
:include [[rt.base :complete]]}
393-
394-
xyz.zcaudate/rt.basic
395-
{:description "wrapper for nginx"
396-
:include [[rt.basic :complete]]
397-
:dependencies [http-kit]}
398-
399-
xyz.zcaudate/rt.circom
400-
{:description "runtime for circom"
401-
:include [[rt.circom :complete]]}
402-
403-
xyz.zcaudate/rt.fortran
404-
{:description "runtime for fortran"
405-
:include [[rt.fortran :complete]]}
406-
407367
xyz.zcaudate/rt.graal
408-
{:description "runtime for graal contexts"
409-
:include [[rt.graal :complete]]
410-
:bundle [{:path "target/classes"
411-
:include ["hara/lib/graal"]}]
412-
:dependencies [org.graalvm.sdk/graal-sdk
413-
org.graalvm.js/js
368+
{:description "runtime for graal contexts"
369+
:include [[rt.graal :complete]
370+
[hara.runtime.graal :complete]]
371+
:bundle [{:path "target/classes"
372+
:include ["hara/lib/graal"]}]
373+
:dependencies [org.graalvm.sdk/graal-sdk
374+
org.graalvm.js/js
414375
org.graalvm.js/js-scriptengine
415376
commons-io/commons-io]}
416377

417378
xyz.zcaudate/rt.jep
418-
{:description "runtime for jep"
419-
:include [[rt.jep :complete]]
420-
:dependencies [black.ninia/jep]}
421-
422-
xyz.zcaudate/rt.libpython
423-
{:description "runtime for libpython"
424-
:include [[rt.libpython :complete]]
425-
:dependencies [clj-python/libpython-clj]}
426-
427-
xyz.zcaudate/rt.llvm
428-
{:description "runtime for llvm"
429-
:include [[rt.llvm :complete]]}
379+
{:description "runtime for jep"
380+
:include [[rt.jep :complete]
381+
[hara.runtime.jep :complete]]
382+
:dependencies [black.ninia/jep]}
430383

431-
xyz.zcaudate/rt.nginx
432-
{:description "runtime for nginx"
433-
:include [[rt.nginx :complete]]}
434-
435-
xyz.zcaudate/rt.nix
436-
{:description "runtime for nix"
437-
:include [[rt.nix :complete]]}
438-
439-
xyz.zcaudate/rt.postgres
440-
{:description "runtime for postgres"
441-
:include [[rt.postgres :complete]]}
442-
443384
xyz.zcaudate/rt.redis
444-
{:description "runtime for redis"
445-
:include [[rt.redis :complete]]
446-
:bundle [{:path "resources" :include ["assets/rt.redis"]}]}
447-
448-
xyz.zcaudate/rt.shell
449-
{:description "shell runtime"
450-
:include [[rt.shell :complete]]}
451-
452-
xyz.zcaudate/rt.solidity
453-
{:description "shell runtime"
454-
:include [[rt.solidity :complete]]}
455-
456-
xyz.zcaudate/rt.verilog
457-
{:description "runtime for verilog"
458-
:include [[rt.verilog :complete]]}
385+
{:description "runtime for redis"
386+
:include [[rt.redis :complete]
387+
[hara.runtime.redis :complete]]
388+
:bundle [{:path "resources" :include ["assets/rt.redis"]}]}
459389

460390
xyz.zcaudate/script.css
461391
{:description "read and write css using clojure"
@@ -540,10 +470,32 @@
540470
com.fasterxml.jackson.datatype/jackson-datatype-jsr310]
541471
:bundle [{:path "target/classes" :include ["hara/lib/json"]}]}
542472

543-
xyz.zcaudate/hara
544-
{:description "working with other languages"
545-
:include [[hara :complete]]}
546-
473+
xyz.zcaudate/hara
474+
{:description "working with other languages"
475+
:include [[hara :exclude [hara.runtime.postgres
476+
hara.runtime.graal
477+
hara.runtime.jep
478+
hara.runtime.redis
479+
hara.runtime.solidity
480+
hara.runtime.nginx
481+
hara.model.spec-postgres]]
482+
[xt.lang :complete]]}
483+
484+
xyz.zcaudate/hara.runtime.nginx
485+
{:description "nginx runtime support"
486+
:include [[hara.runtime.nginx :complete]]}
487+
488+
xyz.zcaudate/postgres
489+
{:description "postgres language and runtime support"
490+
:include [[postgres :complete]
491+
[hara.model.spec-postgres :complete]
492+
[hara.runtime.postgres :complete]]}
493+
494+
xyz.zcaudate/solidity
495+
{:description "solidity language and runtime support"
496+
:include [[solidity.core :complete]
497+
[hara.runtime.solidity :complete]]}
498+
547499
xyz.zcaudate/std.lib
548500
{:description "simple string methods for searching"
549501
:bundle [{:path "target/classes"
@@ -621,20 +573,8 @@
621573
xyz.zcaudate/xtalk.db
622574
{:description "xtalk language"
623575
:include [[xt.db :complete]]}
624-
625-
xyz.zcaudate/xtalk.evm
626-
{:description "xtalk evm"
627-
:include [[xt.evm :complete]]}
628576

629-
xyz.zcaudate/xtalk.lang
630-
{:description "xtalk language"
631-
:include [[xt.lang :complete]
632-
[xt.lang.common-module :complete]]}
633-
634577
xyz.zcaudate/xtalk.runtime
635578
{:description "xtalk language"
636579
:include [[kmi.lang :complete]]}
637-
638-
xyz.zcaudate/xtalk.system
639-
{:description "xtalk language"
640-
:include [[xt.sys :complete]]}}
580+
}

src/code/framework/link.clj

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -88,27 +88,31 @@
8888
{:added "3.0"}
8989
([package lookup]
9090
(let [nsps (keys lookup)]
91-
(mapcat (fn [[ns type select]]
92-
(case type
93-
:base (filter (fn [sym] (or (= sym ns)
94-
(.startsWith (str sym)
95-
(str ns ".base."))))
96-
nsps)
97-
:complete (filter (fn [sym] (or (= sym ns)
98-
(.startsWith (str sym)
99-
(str ns "."))))
100-
nsps)
101-
:exclude (filter (fn [sym]
102-
(and (or (= sym ns)
103-
(.startsWith (str sym)
104-
(str ns ".")))
105-
(not ((set select) ns))))
106-
nsps)
107-
(throw (ex-info "Not supported." {:type type
108-
:options [:base
109-
:complete
110-
:exclude]}))))
111-
(:include package)))))
91+
(mapcat (fn [[ns type select]]
92+
(case type
93+
:base (filter (fn [sym] (or (= sym ns)
94+
(.startsWith (str sym)
95+
(str ns ".base."))))
96+
nsps)
97+
:complete (filter (fn [sym] (or (= sym ns)
98+
(.startsWith (str sym)
99+
(str ns "."))))
100+
nsps)
101+
:exclude (filter (fn [sym]
102+
(and (or (= sym ns)
103+
(.startsWith (str sym)
104+
(str ns ".")))
105+
(not-any? (fn [excluded]
106+
(or (= sym excluded)
107+
(.startsWith (str sym)
108+
(str excluded "."))))
109+
select)))
110+
nsps)
111+
(throw (ex-info "Not supported." {:type type
112+
:options [:base
113+
:complete
114+
:exclude]}))))
115+
(:include package)))))
112116

113117
(defn collect-entries
114118
"collects all entries given packages and lookups

src/hara/lang.clj

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -197,14 +197,24 @@
197197
m
198198
(ptr/get-entry m)))
199199

200+
(defn- trim-trailing-nils
201+
[v]
202+
(->> v
203+
reverse
204+
(drop-while nil?)
205+
reverse
206+
vec))
207+
200208
(defn as-lua
201-
"change `[]` to `{}`"
209+
"change `[]` to `{}` and trim trailing nils from vectors"
202210
{:added "4.0"}
203211
[input]
204212
(walk/prewalk (fn [form]
205-
(cond (and (vector? form)
206-
(empty? form))
207-
{}
213+
(cond (vector? form)
214+
(let [form (trim-trailing-nils form)]
215+
(if (empty? form)
216+
{}
217+
form))
208218

209219
(map? form)
210220
(coll/filter-vals (comp not nil?) form)

src/hara/seedgen.clj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@
212212
(invoke/definvoke seedgen-benchadd
213213
[:task {:template :code.transform
214214
:params {:title "SEEDGEN BENCHADD"
215-
:parallel true
215+
:parallel false
216216
:print {:function true}}
217217
:main {:fn #'seedgen-benchadd-summary}
218218
:item {:list seedgen-test-namespaces

src/hara/seedgen/form_infile.clj

Lines changed: 22 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -649,43 +649,28 @@
649649
[s from to]
650650
(if (= from to)
651651
s
652-
(letfn [(next-after-subtree [zloc]
653-
(loop [current zloc]
654-
(or (nav/right current)
655-
(let [parent (nav/up current)]
656-
(when (and parent
657-
(not= parent current))
658-
(recur parent))))))
659-
(next-preorder [zloc]
660-
(or (nav/down zloc)
661-
(next-after-subtree zloc)))
662-
(replace-once [expr-str]
663-
(let [root (nav/parse-root expr-str)
664-
expr-nav (nav/down root)
665-
body-nav (some-> expr-nav form-common/nav-body)]
666-
(if body-nav
667-
(loop [current body-nav]
668-
(cond
669-
(nil? current)
670-
[expr-str false]
671-
672-
(= from (nav/value current))
673-
[(-> current
674-
(nav/replace to)
675-
nav/root-string)
676-
true]
677-
678-
:else
679-
(if-let [next (next-preorder current)]
680-
(recur next)
681-
[expr-str false])))
682-
[expr-str false])))]
683-
(loop [out s]
684-
(let [[next-out replaced?] (replace-once out)]
685-
(if (and replaced?
686-
(not= out next-out))
687-
(recur next-out)
688-
next-out))))))
652+
(letfn [(rewrite-postwalk [zloc]
653+
(let [zloc (if-let [child (nav/down zloc)]
654+
(loop [parent zloc
655+
child child]
656+
(if child
657+
(let [child' (rewrite-postwalk child)
658+
next (nav/right child')
659+
parent' (nav/up child')]
660+
(recur parent' next))
661+
parent))
662+
zloc)]
663+
(if (= from (nav/value zloc))
664+
(nav/replace zloc to)
665+
zloc)))]
666+
(let [root (nav/parse-root s)
667+
expr-nav (nav/down root)
668+
body-nav (some-> expr-nav form-common/nav-body)]
669+
(if body-nav
670+
(-> body-nav
671+
rewrite-postwalk
672+
nav/root-string)
673+
s)))))
689674

690675
(defn- apply-item-transform-string
691676
[s entry item lang]

src/lib/redis/bench.clj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
(:require [clojure.string]
33
[std.fs :as fs]
44
[std.json :as json]
5-
[hara.lang :as l]
65
[std.lib.collection :as collection]
76
[std.lib.env :as env]
87
[std.lib.foundation :as f]

test-lang/xt/db/instance_test.clj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@
8686
^{:refer xt.db.instance/remove-trigger :added "4.1"}
8787
(fact "removes triggers from the db map"
8888

89+
^{:seedgen/base {:lua {:expect (l/as-lua [{"id" "watch"} nil])}}}
8990
(!.js
9091
(var db {:triggers {"watch" {:id "watch"}}})
9192
[(instance/remove-trigger db "watch")
@@ -106,6 +107,7 @@
106107
^{:refer xt.db.instance/db-create :added "4.1"}
107108
(fact "creates db wrappers with handlers and throttle state"
108109

110+
^{:seedgen/base {:lua {:expect (l/as-lua ["db.create" "instance-a" [] {} true true true "test"])}}}
109111
(!.js
110112
(xt/x:set-key instance/IMPL
111113
"db.create"
@@ -129,6 +131,7 @@
129131
^{:refer xt.db.instance/queue-event :added "4.1"}
130132
(fact "queues events and hands them to the throttle"
131133

134+
^{:seedgen/base {:lua {:expect (l/as-lua [1 42 []])}}}
132135
(!.js
133136
(var db {:events []
134137
:throttle (th/throttle-create

0 commit comments

Comments
 (0)