Skip to content

Commit f0e1a6f

Browse files
committed
test: Run with-test tests
1 parent 9e4ff77 commit f0e1a6f

File tree

4 files changed

+14
-13
lines changed

4 files changed

+14
-13
lines changed

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
Shortcuts for wasm
44

5-
| wasm-hl | wasm |
5+
| wah | wasm |
66
|---------------|-------------------------------------------|
77
| `(0 = 1)` | `(set_local 0 (f64.const 0))` |
88
| `(%$a + %$b)` | `(f64.add (get_local $a) (get_local $b))` |
@@ -23,7 +23,7 @@ Shortcuts for wasm
2323

2424
FIXME: explanation
2525

26-
$ java -jar wasm-hl-0.1.0-standalone.jar [args]
26+
$ java -jar wah-0.1.0-standalone.jar [args]
2727

2828
## Options
2929

project.clj

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
1-
(defproject wasm-hl "0.1.0-SNAPSHOT"
2-
:description "FIXME: write description"
1+
(defproject wah "0.1.0-SNAPSHOT"
2+
:description "Convenience syntax for WAST"
33
:url "http://example.com/FIXME"
4+
:test-paths ["src"]
45
:license {:name "Eclipse Public License"
56
:url "http://www.eclipse.org/legal/epl-v10.html"}
67
:dependencies [
78
[org.clojure/tools.cli "0.3.5"]
89
[org.clojure/tools.reader "1.0.0-beta4"]
910
[org.clojure/clojure "1.8.0"]]
1011
:plugins [[lein-cljfmt "0.5.6"]]
11-
:main ^:skip-aot wasm-hl.core
12+
:main ^:skip-aot wah.core
1213
:target-path "target/%s"
1314
:profiles {:uberjar {:aot :all}})
File renamed without changes.

src/wasm_hl/core.clj src/wah/core.clj

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
(ns wasm-hl.core
1+
(ns wah.core
22
(:require [clojure.tools.cli :refer [cli]])
33
(:require [clojure.tools.reader.edn :as edn])
44
(:require [clojure.walk :as w])
@@ -149,7 +149,7 @@
149149
(is (= {:type 'i32} (meta (assign-final-types {'$f 'i32} '(get_local $f))))))
150150

151151
(with-test
152-
(defn wasm-hl-to-wasm
152+
(defn wah-to-wasm
153153
"Transform a wasm hl edn to a wasm edn"
154154
[expr]
155155
(let [arranged-tree (w/prewalk
@@ -159,11 +159,11 @@
159159
(w/postwalk
160160
(partial assign-final-types type-map)
161161
arranged-tree)))
162-
(is (= '(i32.add (i32.const 0) (i32.const 0)) (wasm-hl-to-wasm '(0 + 0))))
163-
(is (= '(i32.add (i32.const 0) (i32.add (i32.const 0) (i32.const 1))) (wasm-hl-to-wasm '(0 + (0 + 1)))))
164-
(is (= '(f64.add (f64.const 0.0) (f64.const 1.0)) (wasm-hl-to-wasm '(0.0 + 1.0))))
165-
(is (= '(func (local $foo f64) (f64.add (f64.const 0.0) (get_local $foo))) (wasm-hl-to-wasm '(func (local $foo f64) (0.0 + %$foo)))))
166-
(is (= 'i32 (get (meta (second (wasm-hl-to-wasm '(0 + 0)))) :type))))
162+
(is (= '(i32.add (i32.const 0) (i32.const 0)) (wah-to-wasm '(0 + 0))))
163+
(is (= '(i32.add (i32.const 0) (i32.add (i32.const 0) (i32.const 1))) (wah-to-wasm '(0 + (0 + 1)))))
164+
(is (= '(f64.add (f64.const 0.0) (f64.const 1.0)) (wah-to-wasm '(0.0 + 1.0))))
165+
(is (= '(func (local $foo f64) (f64.add (f64.const 0.0) (get_local $foo))) (wah-to-wasm '(func (local $foo f64) (0.0 + %$foo)))))
166+
(is (= 'i32 (get (meta (second (wah-to-wasm '(0 + 0)))) :type))))
167167

168168
(defn -main
169169
"compile wast-hl to wast"
@@ -172,4 +172,4 @@
172172
["-h" "--help" "Print this help"
173173
:default false :flag true])]
174174
(clojure.pprint/pprint
175-
(wasm-hl-to-wasm (edn/read-string (slurp (first args)))))))
175+
(wah-to-wasm (edn/read-string (slurp (first args)))))))

0 commit comments

Comments
 (0)