aboutsummaryrefslogtreecommitdiff
path: root/test/bun.js/bun-jsc.test.js
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2022-06-22 23:21:48 -0700
committerGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2022-06-22 23:21:48 -0700
commit729d445b6885f69dd2c6355f38707bd42851c791 (patch)
treef87a7c408929ea3f57bbb7ace380cf869da83c0e /test/bun.js/bun-jsc.test.js
parent25f820c6bf1d8ec6d444ef579cc036b8c0607b75 (diff)
downloadbun-729d445b6885f69dd2c6355f38707bd42851c791.tar.gz
bun-729d445b6885f69dd2c6355f38707bd42851c791.tar.zst
bun-729d445b6885f69dd2c6355f38707bd42851c791.zip
change the directory structurejarred/rename
Diffstat (limited to 'test/bun.js/bun-jsc.test.js')
-rw-r--r--test/bun.js/bun-jsc.test.js98
1 files changed, 98 insertions, 0 deletions
diff --git a/test/bun.js/bun-jsc.test.js b/test/bun.js/bun-jsc.test.js
new file mode 100644
index 000000000..8ee0decf2
--- /dev/null
+++ b/test/bun.js/bun-jsc.test.js
@@ -0,0 +1,98 @@
+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,
+ startRemoteDebugger,
+} 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) > 0).toBe(true);
+ });
+ it("releaseWeakRefs", () => {
+ releaseWeakRefs();
+ });
+ it("totalCompileTime", () => {
+ totalCompileTime(count);
+ });
+ it("reoptimizationRetryCount", () => {
+ reoptimizationRetryCount(count);
+ });
+ it("drainMicrotasks", () => {
+ drainMicrotasks();
+ });
+ it("startRemoteDebugger", () => {
+ startRemoteDebugger("");
+ });
+});