summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--std/testing/format.ts7
-rw-r--r--std/testing/format_test.ts8
2 files changed, 15 insertions, 0 deletions
diff --git a/std/testing/format.ts b/std/testing/format.ts
index ee291dc23..4004ebc9d 100644
--- a/std/testing/format.ts
+++ b/std/testing/format.ts
@@ -115,6 +115,10 @@ function printSymbol(val: symbol): string {
return symbolToString.call(val).replace(SYMBOL_REGEXP, "Symbol($1)");
}
+function printBigInt(val: bigint): string {
+ return val.toString() + "n";
+}
+
function printError(val: Error): string {
return "[" + errorToString.call(val) + "]";
}
@@ -155,6 +159,9 @@ function printBasicValue(
if (typeOf === "symbol") {
return printSymbol(val);
}
+ if (typeOf === "bigint") {
+ return printBigInt(val);
+ }
const toStringed = toString.call(val);
diff --git a/std/testing/format_test.ts b/std/testing/format_test.ts
index eac5b7d84..f4065ff92 100644
--- a/std/testing/format_test.ts
+++ b/std/testing/format_test.ts
@@ -581,6 +581,14 @@ test({
});
test({
+ name: "prints a bigint",
+ fn(): void {
+ const val = 12345n;
+ assertEquals(format(val), "12345n");
+ },
+});
+
+test({
name: "prints undefined",
fn(): void {
const val = undefined;