summaryrefslogtreecommitdiff
path: root/std/fmt
diff options
context:
space:
mode:
Diffstat (limited to 'std/fmt')
-rw-r--r--std/fmt/printf_test.ts23
1 files changed, 7 insertions, 16 deletions
diff --git a/std/fmt/printf_test.ts b/std/fmt/printf_test.ts
index 81e172f81..e4399812b 100644
--- a/std/fmt/printf_test.ts
+++ b/std/fmt/printf_test.ts
@@ -7,7 +7,6 @@
import { sprintf } from "./printf.ts";
import { assertEquals } from "../testing/asserts.ts";
-import { cyan, yellow } from "./colors.ts";
const S = sprintf;
@@ -607,12 +606,12 @@ Deno.test("testWeirdos", function (): void {
Deno.test("formatV", function (): void {
const a = { a: { a: { a: { a: { a: { a: { a: {} } } } } } } };
assertEquals(S("%v", a), "[object Object]");
- assertEquals(S("%#v", a), `{ a: { a: { a: { a: ${cyan("[Object]")} } } } }`);
+ assertEquals(S("%#v", a), `{ a: { a: { a: { a: [Object] } } } }`);
assertEquals(
S("%#.8v", a),
"{ a: { a: { a: { a: { a: { a: { a: {} } } } } } } }",
);
- assertEquals(S("%#.1v", a), `{ a: ${cyan("[Object]")} }`);
+ assertEquals(S("%#.1v", a), `{ a: [Object] }`);
});
Deno.test("formatJ", function (): void {
@@ -625,9 +624,7 @@ Deno.test("flagLessThan", function (): void {
const aArray = [a, a, a];
assertEquals(
S("%<#.1v", aArray),
- `[ { a: ${cyan("[Object]")} }, { a: ${cyan("[Object]")} }, { a: ${
- cyan("[Object]")
- } } ]`,
+ `[ { a: [Object] }, { a: [Object] }, { a: [Object] } ]`,
);
const fArray = [1.2345, 0.98765, 123456789.5678];
assertEquals(S("%<.2f", fArray), "[ 1.23, 0.99, 123456789.57 ]");
@@ -649,27 +646,21 @@ Deno.test("testErrors", function (): void {
assertEquals(S("%.*f", "a", 1.1), "%!(BAD PREC 'a')");
assertEquals(
S("%.[2]*f", 1.23, "p"),
- `%!(BAD PREC 'p')%!(EXTRA '${yellow("1.23")}')`,
+ `%!(BAD PREC 'p')%!(EXTRA '1.23')`,
);
assertEquals(S("%.[2]*[1]f Yippie!", 1.23, "p"), "%!(BAD PREC 'p') Yippie!");
assertEquals(S("%[1]*.2f", "a", "p"), "%!(BAD WIDTH 'a')");
- assertEquals(
- S("A", "a", "p"),
- `A%!(EXTRA '\x1b[32m"a"\x1b[39m' '\x1b[32m"p"\x1b[39m')`,
- );
- assertEquals(
- S("%[2]s %[2]s", "a", "p"),
- `p p%!(EXTRA '\x1b[32m"a"\x1b[39m')`,
- );
+ assertEquals(S("A", "a", "p"), `A%!(EXTRA '"a"' '"p"')`);
+ assertEquals(S("%[2]s %[2]s", "a", "p"), `p p%!(EXTRA '"a"')`);
// remains to be determined how to handle bad indices ...
// (realistically) the entire error handling is still up for grabs.
assertEquals(S("%[hallo]s %d %d %d", 1, 2, 3, 4), "%!(BAD INDEX) 2 3 4");
assertEquals(
S("%[5]s", 1, 2, 3, 4),
- `%!(BAD INDEX)%!(EXTRA '${yellow("2")}' '${yellow("3")}' '${yellow("4")}')`,
+ `%!(BAD INDEX)%!(EXTRA '2' '3' '4')`,
);
assertEquals(S("%[5]f"), "%!(BAD INDEX)");
assertEquals(S("%.[5]f"), "%!(BAD INDEX)");