aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--test/cli/bun.test.ts27
1 files changed, 27 insertions, 0 deletions
diff --git a/test/cli/bun.test.ts b/test/cli/bun.test.ts
index 97ea52ecd..8bb3ca744 100644
--- a/test/cli/bun.test.ts
+++ b/test/cli/bun.test.ts
@@ -32,4 +32,31 @@ describe("bun", () => {
});
}
});
+
+ describe("revision", () => {
+ test("revision generates version numbers correctly", () => {
+ var { stdout, exitCode } = Bun.spawnSync({
+ cmd: [bunExe(), "--version"],
+ env: {},
+ stderr: "inherit",
+ });
+ var version = stdout.toString().trim();
+
+ var { stdout, exitCode } = Bun.spawnSync({
+ cmd: [bunExe(), "--revision"],
+ env: {},
+ stderr: "inherit",
+ });
+ var revision = stdout.toString().trim();
+
+ expect(exitCode).toBe(0);
+ expect(revision).toStartWith(version);
+ // https://semver.org/#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string
+ expect(revision).toMatch(
+ new RegExp(
+ "^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?$",
+ ),
+ );
+ });
+ });
});