Skip to content

Commit f699120

Browse files
committed
bun test
1 parent fad98cf commit f699120

File tree

5 files changed

+2902
-4
lines changed

5 files changed

+2902
-4
lines changed

.github/workflows/bun.yml

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: 'Tests: Bun'
2+
3+
on: [pull_request, push]
4+
5+
jobs:
6+
# misc test
7+
misc:
8+
name: 'misc (with codepage)'
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v2
12+
- uses: antongolub/action-setup-bun
13+
- uses: ljharb/actions/node/install@main
14+
with:
15+
node-version: '16.'
16+
- run: sudo curl -Lo /usr/bin/rooster https://github.com/SheetJS/rooster/releases/download/v0.2.0/rooster-v0.2.0-linux-amd64
17+
- run: sudo chmod a+x /usr/bin/rooster
18+
- run: make init
19+
- run: 'cd test_files; make all; cd -'
20+
- run: 'env FMTS=misc bun hotcross.mjs'

Makefile

+9
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,10 @@ test-esm: test.mjs ## Run Node ESM test suite
144144
test.ts: test.mts
145145
node -pe 'var data = fs.readFileSync("'$<'", "utf8"); data.split("\n").map(function(l) { return l.replace(/^describe\((.*?)function\(\)/, "Deno.test($$1async function(t)").replace(/\b(?:it|describe)\((.*?)function\(\)/g, "await t.step($$1async function(t)").replace("assert.ok", "assert.assert"); }).join("\n")' > $@
146146

147+
.PHONY: test-bun
148+
test-bun: hotcross.mjs ## Run Bun test suite
149+
bun $<
150+
147151
.PHONY: test-deno
148152
test-deno: test.ts ## Run Deno test suite
149153
deno test --allow-env --allow-read --allow-write --config misc/test.deno.jsonc $<
@@ -174,6 +178,11 @@ TESTDENOCPFMT=$(patsubst %,test-denocp_%,$(FMT))
174178
$(TESTDENOCPFMT): test-denocp_%:
175179
FMTS=$* make test-denocp
176180

181+
TESTBUNFMT=$(patsubst %,test-bun_%,$(FMT))
182+
.PHONY: $(TESTBUNFMT)
183+
$(TESTBUNFMT): test-bun_%:
184+
FMTS=$* make test-bun
185+
177186
.PHONY: travis
178187
travis: ## Run test suite with minimal output
179188
mocha -R dot -t 30000

bits/24_hoppers.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,11 @@ function buf_array()/*:BufArray*/ {
3131

3232
var endbuf = function ba_endbuf() {
3333
if(!curbuf) return;
34-
if(curbuf.length > curbuf.l) { curbuf = curbuf.slice(0, curbuf.l); curbuf.l = curbuf.length; }
35-
if(curbuf.length > 0) bufs.push(curbuf);
34+
// workaround for new Buffer(3).slice(0,0) bug in bun 0.1.3
35+
if(curbuf.l) {
36+
if(curbuf.length > curbuf.l) { curbuf = curbuf.slice(0, curbuf.l); curbuf.l = curbuf.length; }
37+
if(curbuf.length > 0) bufs.push(curbuf);
38+
}
3639
curbuf = null;
3740
};
3841

0 commit comments

Comments
 (0)