diff options
author | 2022-06-01 07:31:14 -0700 | |
---|---|---|
committer | 2022-06-01 07:31:14 -0700 | |
commit | 121c2960de87c53cc6bdd5f92fab627a74d21a2b (patch) | |
tree | 0ad6c532dc6b75f6f1fe3bfd4a7e90ec49c87d92 | |
parent | a96a2a8b12e1c79de8775b2c1c5cb50be503feac (diff) | |
download | bun-121c2960de87c53cc6bdd5f92fab627a74d21a2b.tar.gz bun-121c2960de87c53cc6bdd5f92fab627a74d21a2b.tar.zst bun-121c2960de87c53cc6bdd5f92fab627a74d21a2b.zip |
Create bun-jsc.test.js
-rw-r--r-- | integration/bunjs-only-snippets/bun-jsc.test.js | 94 |
1 files changed, 94 insertions, 0 deletions
diff --git a/integration/bunjs-only-snippets/bun-jsc.test.js b/integration/bunjs-only-snippets/bun-jsc.test.js new file mode 100644 index 000000000..e329bc092 --- /dev/null +++ b/integration/bunjs-only-snippets/bun-jsc.test.js @@ -0,0 +1,94 @@ +import { describe, expect, it } from "bun:test"; +import { + describe as jscDescribe, + describeArray, + gcAndSweep, + fullGC, + edenGC, + heapSize, + heapStats, + memoryUsage, + getRandomSeed, + setRandomSeed, + isRope, + callerSourceOrigin, + noFTL, + noOSRExitFuzzing, + optimizeNextInvocation, + numberOfDFGCompiles, + releaseWeakRefs, + totalCompileTime, + reoptimizationRetryCount, + drainMicrotasks, +} from "bun:jsc"; + +describe("bun:jsc", () => { + function count() { + var j = 0; + for (var i = 0; i < 999999; i++) { + j += i + 2; + } + + return j; + } + + it("describe", () => { + jscDescribe([]); + }); + it("describeArray", () => { + describeArray([1, 2, 3]); + }); + it("gcAndSweep", () => { + gcAndSweep(); + }); + it("fullGC", () => { + fullGC(); + }); + it("edenGC", () => { + edenGC(); + }); + it("heapSize", () => { + expect(heapSize() > 0).toBe(true); + }); + it("heapStats", () => { + heapStats(); + }); + it("memoryUsage", () => { + memoryUsage(); + }); + it("getRandomSeed", () => { + getRandomSeed(2); + }); + it("setRandomSeed", () => { + setRandomSeed(2); + }); + it("isRope", () => { + expect(isRope("a" + 123 + "b")).toBe(true); + expect(isRope("abcdefgh")).toBe(false); + }); + it("callerSourceOrigin", () => { + expect(callerSourceOrigin()).toBe(import.meta.url); + }); + it("noFTL", () => {}); + it("noOSRExitFuzzing", () => {}); + it("optimizeNextInvocation", () => { + count(); + optimizeNextInvocation(count); + count(); + }); + it("numberOfDFGCompiles", () => { + expect(numberOfDFGCompiles(count)).toBe(3); + }); + it("releaseWeakRefs", () => { + releaseWeakRefs(); + }); + it("totalCompileTime", () => { + totalCompileTime(count); + }); + it("reoptimizationRetryCount", () => { + reoptimizationRetryCount(count); + }); + it("drainMicrotasks", () => { + drainMicrotasks(); + }); +}); |