Skip to content

Commit

Permalink
bun test
Browse files Browse the repository at this point in the history
  • Loading branch information
SheetJSDev committed Jul 12, 2022
1 parent fad98cf commit f699120
Show file tree
Hide file tree
Showing 5 changed files with 2,902 additions and 4 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/bun.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: 'Tests: Bun'

on: [pull_request, push]

jobs:
# misc test
misc:
name: 'misc (with codepage)'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: antongolub/action-setup-bun
- uses: ljharb/actions/node/install@main
with:
node-version: '16.'
- run: sudo curl -Lo /usr/bin/rooster https://github.com/SheetJS/rooster/releases/download/v0.2.0/rooster-v0.2.0-linux-amd64
- run: sudo chmod a+x /usr/bin/rooster
- run: make init
- run: 'cd test_files; make all; cd -'
- run: 'env FMTS=misc bun hotcross.mjs'
9 changes: 9 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,10 @@ test-esm: test.mjs ## Run Node ESM test suite
test.ts: test.mts
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")' > $@

.PHONY: test-bun
test-bun: hotcross.mjs ## Run Bun test suite
bun $<

.PHONY: test-deno
test-deno: test.ts ## Run Deno test suite
deno test --allow-env --allow-read --allow-write --config misc/test.deno.jsonc $<
Expand Down Expand Up @@ -174,6 +178,11 @@ TESTDENOCPFMT=$(patsubst %,test-denocp_%,$(FMT))
$(TESTDENOCPFMT): test-denocp_%:
FMTS=$* make test-denocp

TESTBUNFMT=$(patsubst %,test-bun_%,$(FMT))
.PHONY: $(TESTBUNFMT)
$(TESTBUNFMT): test-bun_%:
FMTS=$* make test-bun

.PHONY: travis
travis: ## Run test suite with minimal output
mocha -R dot -t 30000
Expand Down
7 changes: 5 additions & 2 deletions bits/24_hoppers.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,11 @@ function buf_array()/*:BufArray*/ {

var endbuf = function ba_endbuf() {
if(!curbuf) return;
if(curbuf.length > curbuf.l) { curbuf = curbuf.slice(0, curbuf.l); curbuf.l = curbuf.length; }
if(curbuf.length > 0) bufs.push(curbuf);
// workaround for new Buffer(3).slice(0,0) bug in bun 0.1.3
if(curbuf.l) {
if(curbuf.length > curbuf.l) { curbuf = curbuf.slice(0, curbuf.l); curbuf.l = curbuf.length; }
if(curbuf.length > 0) bufs.push(curbuf);
}
curbuf = null;
};

Expand Down
Loading

0 comments on commit f699120

Please sign in to comment.