Skip to content

Commit ad83b3e

Browse files
authored
More trivial source build tests verifying DCE doesn't regress (#259)
* add two more trivial output tests - keyword should be very small - vector by itself should be reasonable - bump windows version
1 parent 9bb3942 commit ad83b3e

File tree

5 files changed

+37
-5
lines changed

5 files changed

+37
-5
lines changed

.github/workflows/test.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ jobs:
6262
# Runtime Tests
6363
runtime-windows-test:
6464
name: Runtime Windows Tests
65-
runs-on: windows-2019
65+
runs-on: windows-2022
6666
steps:
6767
- uses: actions/checkout@v2
6868

@@ -215,7 +215,7 @@ jobs:
215215
# Compiler Windows Tests
216216
compiler-windows-test:
217217
name: Compiler Windows Tests
218-
runs-on: windows-2019
218+
runs-on: windows-2022
219219
steps:
220220
- uses: actions/checkout@v2
221221

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
(ns trivial.core2)
22

3-
(. js/console (-lookup 1 2))
3+
(.log js/console (-lookup 1 2))
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
(ns trivial.core3)
2+
3+
(.log js/console :foo)
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
(ns trivial.core4)
2+
3+
(.log js/console [])

src/test/clojure/cljs/build_api_tests.clj

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -718,7 +718,7 @@
718718
cenv (env/default-compiler-env)]
719719
(test/delete-out-files out)
720720
(build/build (build/inputs (io/file inputs "trivial/core.cljs")) opts cenv)
721-
(is (< (.length out-file) 10000))))
721+
(is (< (.length out-file) 10240))))
722722

723723
(deftest trivial-output-size-protocol
724724
(let [out (.getPath (io/file (test/tmp-dir) "trivial-output-protocol-test-out"))
@@ -731,7 +731,33 @@
731731
cenv (env/default-compiler-env)]
732732
(test/delete-out-files out)
733733
(build/build (build/inputs (io/file inputs "trivial/core2.cljs")) opts cenv)
734-
(is (< (.length out-file) 10000))))
734+
(is (< (.length out-file) 10240))))
735+
736+
(deftest trivial-output-size-keyword
737+
(let [out (.getPath (io/file (test/tmp-dir) "trivial-output-keyword-test-out"))
738+
out-file (io/file out "main.js")
739+
{:keys [inputs opts]} {:inputs (str (io/file "src" "test" "cljs_build"))
740+
:opts {:main 'trivial.core3
741+
:output-dir out
742+
:output-to (.getPath out-file)
743+
:optimizations :advanced}}
744+
cenv (env/default-compiler-env)]
745+
(test/delete-out-files out)
746+
(build/build (build/inputs (io/file inputs "trivial/core3.cljs")) opts cenv)
747+
(is (< (.length out-file) 10240))))
748+
749+
(deftest trivial-output-size-vector
750+
(let [out (.getPath (io/file (test/tmp-dir) "trivial-output-vector-test-out"))
751+
out-file (io/file out "main.js")
752+
{:keys [inputs opts]} {:inputs (str (io/file "src" "test" "cljs_build"))
753+
:opts {:main 'trivial.core4
754+
:output-dir out
755+
:output-to (.getPath out-file)
756+
:optimizations :advanced}}
757+
cenv (env/default-compiler-env)]
758+
(test/delete-out-files out)
759+
(build/build (build/inputs (io/file inputs "trivial/core4.cljs")) opts cenv)
760+
(is (< (.length out-file) 32768))))
735761

736762
(deftest cljs-3255-nil-inputs-build
737763
(let [out (.getPath (io/file (test/tmp-dir) "3255-test-out"))

0 commit comments

Comments
 (0)