Compare commits
23 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8052618fa8 | ||
|
|
238a98d9b2 | ||
|
|
57b799e63d | ||
|
|
dad646ce38 | ||
|
|
35696b7c0b | ||
|
|
00d56900e8 | ||
|
|
1fc8ef6adb | ||
|
|
158b36c645 | ||
|
|
b5c65f46e1 | ||
|
|
7e64ce5dd1 | ||
|
|
73b806dbd2 | ||
|
|
0579d6a0ec | ||
|
|
cfee65101f | ||
|
|
4da643cf63 | ||
|
|
aa15e5212a | ||
|
|
e23a222fdb | ||
|
|
6c0cfde92f | ||
|
|
5f6befc577 | ||
|
|
d7b0f9155d | ||
|
|
28c2f6947f | ||
|
|
5c4fb1ccc1 | ||
|
|
5b7678f309 | ||
|
|
f33c68293b |
22 changed files with 169 additions and 48 deletions
|
|
@ -101,7 +101,6 @@
|
|||
"export BABASHKA_FEATURE_JDBC=true
|
||||
export BABASHKA_FEATURE_POSTGRESQL=true
|
||||
script/test\nscript/run_lib_tests")
|
||||
(run "Run as lein command" ".circleci/script/lein")
|
||||
(run
|
||||
"Create uberjar"
|
||||
"mkdir -p /tmp/release
|
||||
|
|
@ -180,10 +179,13 @@ java -jar \"$jar\" --config .build/bb.edn --deps-root . release-artifact \"$refl
|
|||
(run "Build binary" (if (= "aarch64" arch)
|
||||
"script/uberjar\nscript/compile -H:PageSize=64K # --pgo=default.iprof"
|
||||
"script/uberjar\nscript/compile # --pgo=default.iprof") "30m")
|
||||
(run "Run tests" "script/test\nscript/run_lib_tests")
|
||||
(run "Release" ".circleci/script/release")
|
||||
{:persist_to_workspace {:root "/tmp"
|
||||
:paths ["release"]}}
|
||||
(run "Run tests" "script/test\nscript/run_lib_tests")
|
||||
(run "Release + publish"
|
||||
(str/join "\n" ["export BABASHKA_RELEASE=true"
|
||||
".circleci/script/release"]))
|
||||
{:save_cache
|
||||
{:paths ["~/.m2" "~/graalvm"]
|
||||
:key cache-key}}
|
||||
|
|
|
|||
|
|
@ -29,7 +29,9 @@ tar zcvf "$archive" bb # bbk
|
|||
|
||||
cd -
|
||||
|
||||
if [ "$BABASHKA_RELEASE" = "true" ]; then
|
||||
./bb --config .build/bb.edn --deps-root . release-artifact "/tmp/release/$archive"
|
||||
fi
|
||||
|
||||
## cleanup
|
||||
|
||||
|
|
|
|||
11
.github/workflows/build-windows.yml
vendored
11
.github/workflows/build-windows.yml
vendored
|
|
@ -84,6 +84,11 @@ jobs:
|
|||
|
||||
bb --config .build/bb.edn --deps-root . release-artifact %zip%
|
||||
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
path: bb.exe
|
||||
name: babashka-${{ steps.babashka-version.outputs.version }}-${{ matrix.name }}-amd64
|
||||
|
||||
- name: Test binary and libs
|
||||
shell: cmd
|
||||
|
|
@ -92,9 +97,3 @@ jobs:
|
|||
set BABASHKA_TEST_ENV=native
|
||||
call script/test.bat :windows
|
||||
call script/run_lib_tests.bat
|
||||
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
path: bb.exe
|
||||
name: babashka-${{ steps.babashka-version.outputs.version }}-${{ matrix.name }}-amd64
|
||||
|
|
|
|||
19
.github/workflows/build.yml
vendored
19
.github/workflows/build.yml
vendored
|
|
@ -60,9 +60,6 @@ jobs:
|
|||
script/test
|
||||
script/run_lib_tests
|
||||
|
||||
- name: Run as lein command
|
||||
run: echo '{:a 1}' | lein bb '(:a *in*)'
|
||||
|
||||
- name: Build uberjar
|
||||
run: |
|
||||
mkdir -p /tmp/release
|
||||
|
|
@ -175,14 +172,6 @@ jobs:
|
|||
BABASHKA_MUSL: "true"
|
||||
run: script/compile
|
||||
|
||||
- name: Test binary and libs
|
||||
run: |
|
||||
script/test
|
||||
script/run_lib_tests
|
||||
|
||||
- name: Release
|
||||
run: .circleci/script/release
|
||||
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
|
|
@ -196,6 +185,14 @@ jobs:
|
|||
path: bb
|
||||
name: babashka-${{ steps.babashka-version.outputs.version }}-${{ matrix.name }}-static-amd64
|
||||
|
||||
- name: Test binary and libs
|
||||
run: |
|
||||
script/test
|
||||
script/run_lib_tests
|
||||
|
||||
- name: Release
|
||||
run: .circleci/script/release
|
||||
|
||||
docker:
|
||||
if: ${{ false }} # Disabled
|
||||
# if: "!contains(github.event.head_commit.message, 'skip ci') && github.event_name == 'push' && github.ref == 'refs/heads/master'"
|
||||
|
|
|
|||
24
CHANGELOG.md
24
CHANGELOG.md
|
|
@ -7,6 +7,30 @@ A preview of the next release can be installed from
|
|||
|
||||
[Babashka](https://github.com/babashka/babashka): Native, fast starting Clojure interpreter for scripting
|
||||
|
||||
## Unreleased
|
||||
|
||||
- [#1818](https://github.com/babashka/babashka/issues/1818): wrong argument order in `clojure.java.io/resource` implementation
|
||||
- Add `java.text.BreakIterator`
|
||||
- Bump `fs` to `0.5.25`
|
||||
- Bump `jsoup` to `1.20.1`
|
||||
- Bump `edamame` to `1.4.30`
|
||||
- [#1815](https://github.com/babashka/babashka/issues/1815): Make install-script wget-compatible ([@eval](https://github.com/eval))
|
||||
|
||||
|
||||
## 1.12.200 (2025-04-26)
|
||||
|
||||
- Improve Java reflection based on provided type hints (read blog post [here](https://blog.michielborkent.nl/babashka-java-reflection-type-hints.html))
|
||||
- Add compatibility with the [fusebox](https://github.com/potetm/fusebox) library
|
||||
- Fix virtual `ThreadBuilder` interop
|
||||
- Add `java.util.concurrent.ThreadLocalRandom`
|
||||
- Add `java.util.concurrent.locks.ReentrantLock`
|
||||
- Add classes:
|
||||
- `java.time.chrono.ChronoLocalDate`
|
||||
- `java.time.temporal.TemporalUnit`
|
||||
- `java.time.chrono.ChronoLocalDateTime`
|
||||
- `java.time.chrono.ChronoZonedDateTime`
|
||||
- `java.time.chrono.Chronology`
|
||||
|
||||
## 1.12.199 (2025-04-18)
|
||||
|
||||
- [#1806](https://github.com/babashka/babashka/issues/1806): Add `cheshire.factory` namespace ([@lread](https://github.com/lread))
|
||||
|
|
|
|||
|
|
@ -232,6 +232,8 @@ Install via the installer script for linux and macOS:
|
|||
|
||||
``` shell
|
||||
$ curl -sLO https://raw.githubusercontent.com/babashka/babashka/master/install
|
||||
# or
|
||||
$ wget -qO install https://raw.githubusercontent.com/babashka/babashka/master/install
|
||||
$ chmod +x install
|
||||
$ ./install
|
||||
```
|
||||
|
|
|
|||
8
deps.edn
8
deps.edn
|
|
@ -52,7 +52,7 @@
|
|||
org.babashka/cli {:mvn/version "0.8.65"}
|
||||
org.babashka/http-client {:mvn/version "0.4.22"}
|
||||
org.flatland/ordered {:mvn/version "1.15.12"}
|
||||
org.jsoup/jsoup {:mvn/version "1.19.1"}}
|
||||
org.jsoup/jsoup {:mvn/version "1.20.1"}}
|
||||
:aliases {:babashka/dev
|
||||
{:main-opts ["-m" "babashka.main"]}
|
||||
:profile
|
||||
|
|
@ -174,7 +174,11 @@
|
|||
prismatic/plumbing {:git/url "https://github.com/plumatic/plumbing",
|
||||
:git/sha "424bc704f2db422de34269c139a5494314b3a43b"}
|
||||
org.clj-commons/hickory {:git/url "https://github.com/clj-commons/hickory"
|
||||
:git/sha "9385b6708ef35f161732d8464b3a3aa57dd79f30"}}
|
||||
:git/sha "9385b6708ef35f161732d8464b3a3aa57dd79f30"}
|
||||
com.potetm/fusebox {:git/url "https://github.com/potetm/fusebox"
|
||||
:git/sha "ac6d6a0a69510b009b3c1bb2247cd110fd9f7246"}
|
||||
net.sekao/odoyle-rules {:git/url "https://github.com/oakes/odoyle-rules"
|
||||
:git/sha "0b1d825ec45a998c4d3481dfb292e08ce6a47f0b"}}
|
||||
:classpath-overrides {org.clojure/clojure nil
|
||||
org.clojure/spec.alpha nil}}
|
||||
:clj-nvd
|
||||
|
|
|
|||
2
fs
2
fs
|
|
@ -1 +1 @@
|
|||
Subproject commit 64b1c198576fe7babea5500ce6c7cfe6cc92f37b
|
||||
Subproject commit fdd5780bc4df4931332b56082c6c3a5c3c85066d
|
||||
36
install
36
install
|
|
@ -29,6 +29,32 @@ print_help() {
|
|||
exit 1
|
||||
}
|
||||
|
||||
has() {
|
||||
command -v "$1" >/dev/null 2>&1
|
||||
}
|
||||
|
||||
fetch() {
|
||||
local url=$1
|
||||
local outfile=${2:-}
|
||||
|
||||
if has wget; then
|
||||
if [[ -n $outfile ]]; then
|
||||
wget -qO "$outfile" "$url"
|
||||
else
|
||||
wget -qO - "$url"
|
||||
fi
|
||||
elif has curl; then
|
||||
if [[ -n $outfile ]]; then
|
||||
curl -fsSL "$url" -o "$outfile"
|
||||
else
|
||||
curl -fsSL "$url"
|
||||
fi
|
||||
else
|
||||
>&2 echo "Either 'wget' or 'curl' needs to be on PATH!"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
while [[ $# -gt 0 ]]
|
||||
do
|
||||
key="$1"
|
||||
|
|
@ -80,9 +106,9 @@ fi
|
|||
|
||||
if [[ "$version" == "" ]]; then
|
||||
if [[ "$dev_build" == "true" ]]; then
|
||||
version="$(curl -sL https://raw.githubusercontent.com/babashka/babashka/master/resources/BABASHKA_VERSION)"
|
||||
version="$(fetch https://raw.githubusercontent.com/babashka/babashka/master/resources/BABASHKA_VERSION)"
|
||||
else
|
||||
version="$(curl -sL https://raw.githubusercontent.com/babashka/babashka/master/resources/BABASHKA_RELEASED_VERSION)"
|
||||
version="$(fetch https://raw.githubusercontent.com/babashka/babashka/master/resources/BABASHKA_RELEASED_VERSION)"
|
||||
fi
|
||||
fi
|
||||
|
||||
|
|
@ -144,9 +170,9 @@ download_url="https://github.com/babashka/$repo/releases/download/v$version/$fil
|
|||
|
||||
# macOS only have shasum available by default
|
||||
# Some Linux distros (RHEL-like) only have sha256sum available by default (others have both)
|
||||
if command -v sha256sum >/dev/null; then
|
||||
if has sha256sum; then
|
||||
sha256sum_cmd="sha256sum"
|
||||
elif command -v shasum >/dev/null; then
|
||||
elif has shasum; then
|
||||
sha256sum_cmd="shasum -a 256"
|
||||
else
|
||||
>&2 echo "Either 'sha256sum' or 'shasum' needs to be on PATH for '--checksum' flag!"
|
||||
|
|
@ -159,7 +185,7 @@ mkdir -p "$download_dir" && (
|
|||
cd "$download_dir"
|
||||
echo -e "Downloading $download_url to $download_dir"
|
||||
|
||||
curl -o "$filename" -sL "$download_url"
|
||||
fetch "$download_url" "$filename"
|
||||
if [[ -n "$checksum" ]]; then
|
||||
if ! echo "$checksum *$filename" | $sha256sum_cmd --check --status; then
|
||||
>&2 echo "Failed checksum on $filename"
|
||||
|
|
|
|||
|
|
@ -22,11 +22,11 @@
|
|||
:flaky :flaky}
|
||||
:jvm-opts ["--enable-preview"]
|
||||
:dependencies [[org.clojure/clojure "1.12.0"]
|
||||
[borkdude/edamame "1.4.29"]
|
||||
[borkdude/edamame "1.4.30"]
|
||||
[org.clojure/tools.cli "1.0.214"]
|
||||
[cheshire "6.0.0"]
|
||||
[nrepl/bencode "1.2.0"]
|
||||
[borkdude/sci.impl.reflector "0.0.3"]
|
||||
[borkdude/sci.impl.reflector "0.0.4"]
|
||||
[org.babashka/sci.impl.types "0.0.2"]
|
||||
[org.babashka/babashka.impl.java "0.1.10"]
|
||||
[org.clojure/core.async "1.8.741"]
|
||||
|
|
@ -36,7 +36,7 @@
|
|||
[insn/insn "0.5.2"]
|
||||
[org.babashka/cli "0.8.65"]
|
||||
[org.babashka/http-client "0.4.22"]
|
||||
[org.jsoup/jsoup "1.19.1"]
|
||||
[org.jsoup/jsoup "1.20.1"]
|
||||
[borkdude/graal.locking "0.0.2"]]
|
||||
:plugins [[org.kipz/lein-meta-bom "0.1.1"]]
|
||||
:metabom {:jar-name "metabom.jar"}
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
1.12.198
|
||||
1.12.200
|
||||
|
|
@ -1 +1 @@
|
|||
1.12.199
|
||||
1.12.201-SNAPSHOT
|
||||
|
|
@ -52,7 +52,7 @@
|
|||
org.babashka/cli {:mvn/version "0.8.65"}
|
||||
org.babashka/http-client {:mvn/version "0.4.22"}
|
||||
org.flatland/ordered {:mvn/version "1.15.12"}
|
||||
org.jsoup/jsoup {:mvn/version "1.19.1"}}
|
||||
org.jsoup/jsoup {:mvn/version "1.20.1"}}
|
||||
:aliases {:babashka/dev
|
||||
{:main-opts ["-m" "babashka.main"]}
|
||||
:profile
|
||||
|
|
@ -174,7 +174,11 @@
|
|||
prismatic/plumbing {:git/url "https://github.com/plumatic/plumbing",
|
||||
:git/sha "424bc704f2db422de34269c139a5494314b3a43b"}
|
||||
org.clj-commons/hickory {:git/url "https://github.com/clj-commons/hickory"
|
||||
:git/sha "9385b6708ef35f161732d8464b3a3aa57dd79f30"}}
|
||||
:git/sha "9385b6708ef35f161732d8464b3a3aa57dd79f30"}
|
||||
com.potetm/fusebox {:git/url "https://github.com/potetm/fusebox"
|
||||
:git/sha "ac6d6a0a69510b009b3c1bb2247cd110fd9f7246"}
|
||||
net.sekao/odoyle-rules {:git/url "https://github.com/oakes/odoyle-rules"
|
||||
:git/sha "0b1d825ec45a998c4d3481dfb292e08ce6a47f0b"}}
|
||||
:classpath-overrides {org.clojure/clojure nil
|
||||
org.clojure/spec.alpha nil}}
|
||||
:clj-nvd
|
||||
|
|
|
|||
2
sci
2
sci
|
|
@ -1 +1 @@
|
|||
Subproject commit bb544b70ecdf3574bb7600f9203b08041e9d50d0
|
||||
Subproject commit e85433a0214114fdceb4ca896e1b9c27b1bdf713
|
||||
|
|
@ -255,6 +255,10 @@
|
|||
jdk.internal.net.http.websocket.BuilderImpl
|
||||
jdk.internal.net.http.websocket.WebSocketImpl])
|
||||
|
||||
(def thread-builder
|
||||
(try (Class/forName "java.lang.Thread$Builder")
|
||||
(catch Exception _ nil)))
|
||||
|
||||
(def classes
|
||||
`{:all [clojure.lang.ArityException
|
||||
clojure.lang.BigInt
|
||||
|
|
@ -340,6 +344,8 @@
|
|||
java.lang.Throwable
|
||||
java.lang.ThreadLocal
|
||||
java.lang.Thread$UncaughtExceptionHandler
|
||||
~@(when thread-builder
|
||||
'[java.lang.Thread$Builder])
|
||||
java.lang.UnsupportedOperationException
|
||||
java.lang.ref.WeakReference
|
||||
java.lang.ref.ReferenceQueue
|
||||
|
|
@ -429,6 +435,7 @@
|
|||
java.text.ParsePosition
|
||||
;; adds about 200kb, same functionality provided by java.time:
|
||||
java.text.SimpleDateFormat
|
||||
java.text.BreakIterator
|
||||
~@(when features/java-time?
|
||||
`[java.time.format.DateTimeFormatter
|
||||
java.time.Clock
|
||||
|
|
@ -470,7 +477,12 @@
|
|||
java.time.temporal.TemporalAccessor
|
||||
java.time.temporal.TemporalAdjuster
|
||||
java.time.temporal.TemporalQuery
|
||||
~(symbol "[Ljava.time.temporal.TemporalQuery;")])
|
||||
~(symbol "[Ljava.time.temporal.TemporalQuery;")
|
||||
java.time.chrono.ChronoLocalDate
|
||||
java.time.temporal.TemporalUnit
|
||||
java.time.chrono.ChronoLocalDateTime
|
||||
java.time.chrono.ChronoZonedDateTime
|
||||
java.time.chrono.Chronology])
|
||||
java.util.concurrent.atomic.AtomicInteger
|
||||
java.util.concurrent.atomic.AtomicLong
|
||||
java.util.concurrent.atomic.AtomicReference
|
||||
|
|
@ -501,6 +513,9 @@
|
|||
java.util.concurrent.Executors
|
||||
java.util.concurrent.TimeUnit
|
||||
java.util.concurrent.CompletionStage
|
||||
java.util.concurrent.locks.ReentrantLock
|
||||
java.util.concurrent.ThreadLocalRandom
|
||||
java.util.concurrent.ConcurrentHashMap
|
||||
java.util.jar.Attributes
|
||||
java.util.jar.Attributes$Name
|
||||
java.util.jar.JarFile
|
||||
|
|
@ -807,8 +822,13 @@
|
|||
java.lang.Throwable
|
||||
(instance? org.jsoup.nodes.Element v)
|
||||
org.jsoup.nodes.Element
|
||||
(and thread-builder
|
||||
(instance? thread-builder v))
|
||||
thread-builder
|
||||
(instance? java.text.BreakIterator v)
|
||||
java.text.BreakIterator
|
||||
;; keep commas for merge friendliness
|
||||
)]
|
||||
,)]
|
||||
;; (prn :res res)
|
||||
res)))
|
||||
m (assoc m (list 'quote 'clojure.lang.Var) 'sci.lang.Var)
|
||||
|
|
|
|||
|
|
@ -84,8 +84,8 @@
|
|||
cp)))
|
||||
|
||||
(defn resource
|
||||
(^URL [path] (resource @the-url-loader path))
|
||||
(^URL [loader path]
|
||||
(^URL [path] (resource path @the-url-loader))
|
||||
(^URL [path loader]
|
||||
(if (str/starts-with? path "/") nil ;; non-relative paths always return nil
|
||||
(getResource loader [path] true))))
|
||||
|
||||
|
|
|
|||
|
|
@ -14,11 +14,11 @@
|
|||
edn/read-string)
|
||||
deps (:deps deps)
|
||||
deps (assoc deps
|
||||
'babashka/fs {:mvn/version "0.5.22"}
|
||||
'babashka/fs {:mvn/version "0.5.25"}
|
||||
'babashka/babashka.curl {:mvn/version "0.1.2"}
|
||||
'babashka/babashka.core {:git/url "https://github.com/babashka/babashka.core"
|
||||
:git/sha "52a6037bd4b632bffffb04394fb4efd0cdab6b1e"}
|
||||
'babashka/process {:mvn/version "0.5.22"})
|
||||
'babashka/process {:mvn/version "0.6.23"})
|
||||
deps (dissoc deps
|
||||
'borkdude/sci
|
||||
'org.babashka/sci
|
||||
|
|
|
|||
|
|
@ -1190,7 +1190,7 @@ Use bb run --help to show this help output.
|
|||
(println "[babashka] WARNING: config file does not exist:" config))
|
||||
nil))
|
||||
jar (let [jar (resolve-symbolic-link jar)]
|
||||
(some-> [jar] cp/new-loader (cp/resource "META-INF/bb.edn") .toString))
|
||||
(some->> [jar] cp/new-loader (cp/resource "META-INF/bb.edn") .toString))
|
||||
:else (if (and file (fs/exists? file))
|
||||
;; file relative to bb.edn
|
||||
(let [file (abs-path file) ;; follow symlink
|
||||
|
|
|
|||
|
|
@ -75,8 +75,6 @@
|
|||
(doseq [p test-paths]
|
||||
(add-classpath (str (fs/file git-dir p)))))
|
||||
(when-not (and skip-windows (windows?))
|
||||
(prn :branch (current-branch))
|
||||
(prn (System/getenv))
|
||||
(if (and flaky (#{"main" "master"} (current-branch)))
|
||||
(println "Skipping" tns "for main branch because it's marked flaky")
|
||||
(swap! test-nss into tns))))
|
||||
|
|
|
|||
|
|
@ -201,4 +201,20 @@
|
|||
hickory.test.render
|
||||
hickory.test.select
|
||||
hickory.test.zip]}
|
||||
cheshire/cheshire {:git-url "https://github.com/dakrone/cheshire", :test-namespaces [cheshire.test.core], :manually-added true}}
|
||||
cheshire/cheshire {:git-url "https://github.com/dakrone/cheshire", :test-namespaces [cheshire.test.core], :manually-added true}
|
||||
com.potetm/fusebox {:git-url "https://github.com/potetm/fusebox"
|
||||
:git-sha "ac6d6a0a69510b009b3c1bb2247cd110fd9f7246"
|
||||
:test-paths ["test"]
|
||||
:test-namespaces [#_com.potetm.fusebox.bulkhead-test
|
||||
com.potetm.fusebox.bulwark-test
|
||||
com.potetm.fusebox.circuit-breaker-test
|
||||
com.potetm.fusebox.fallback-test
|
||||
com.potetm.fusebox.memoize-test
|
||||
#_com.potetm.fusebox.rate-limit-test
|
||||
com.potetm.fusebox.registry-test
|
||||
com.potetm.fusebox.retry-test
|
||||
#_com.potetm.fusebox.timeout-test]}
|
||||
net.sekao/odoyle-rules {:git-url "https://github.com/oakes/odoyle-rules"
|
||||
:git-sha "0b1d825ec45a998c4d3481dfb292e08ce6a47f0b"
|
||||
:test-paths ["test"]
|
||||
:test-namespaces [odoyle.rules-test]}}
|
||||
|
|
|
|||
|
|
@ -341,7 +341,7 @@
|
|||
(is (= ::response r))))
|
||||
|
||||
(try (get "https://httpbin.org/gzip" {:timeout 1000})
|
||||
(catch java.net.http.HttpTimeoutException _
|
||||
(catch Exception _
|
||||
(doseq [v (vals (ns-publics *ns*))]
|
||||
(when (:integration (meta v))
|
||||
(println "Removing test from" v "because httpbin is slow.")
|
||||
|
|
|
|||
|
|
@ -18,7 +18,10 @@
|
|||
(bb nil (pr-str '(do
|
||||
(def t (Thread. (fn [])))
|
||||
(def vt (Thread/startVirtualThread (fn [])))
|
||||
[(.isVirtual t) (.isVirtual vt)]))))))
|
||||
[(.isVirtual t) (.isVirtual vt)])))))
|
||||
(is (bb nil (pr-str '(instance?
|
||||
java.util.concurrent.Executor
|
||||
(java.util.concurrent.Executors/newThreadPerTaskExecutor (-> (Thread/ofVirtual) (.name "fusebox-thread-" 1) (.factory))))))))
|
||||
|
||||
(deftest domain-sockets-test
|
||||
(is (= :success (bb nil (slurp "test-resources/domain_sockets.bb")))))
|
||||
|
|
@ -239,3 +242,27 @@
|
|||
(bb nil (str "(.getMessage " return-throwable ")"))))))
|
||||
(testing "jsoup Element"
|
||||
(is (= "form" (bb nil "(.tagName (first (.getElementsByTag (org.jsoup.Jsoup/parseBodyFragment \"<form></form>\") \"form\")))")))))
|
||||
|
||||
(deftest cached-thread-pool
|
||||
(is (= 3 (bb nil "(import '(java.util.concurrent Executors ExecutorService))
|
||||
(let [fut (.submit ^ExecutorService (Executors/newCachedThreadPool) ^Callable (fn [] 3))]
|
||||
(.get fut))")))
|
||||
(is (nil? (bb nil "(import '(java.util.concurrent Executors ExecutorService))
|
||||
(let [fut (.submit ^ExecutorService (Executors/newCachedThreadPool) ^Runnable (fn [] 3))]
|
||||
(.get fut))"))))
|
||||
|
||||
(deftest break-iterator-test
|
||||
(is (= 1 (bb nil "(ns dude
|
||||
(:import [java.text BreakIterator]))
|
||||
|
||||
(defn count-characters
|
||||
[^String text]
|
||||
(let [it (BreakIterator/getCharacterInstance)]
|
||||
(.setText it text)
|
||||
(loop [count 0]
|
||||
(if (= (.next it) BreakIterator/DONE)
|
||||
count
|
||||
(recur (inc count))))))
|
||||
|
||||
(prn
|
||||
(count-characters \"🇨🇦\"))"))))
|
||||
|
|
|
|||
Loading…
Reference in a new issue