test(yaml): add int type tests (#5868)

initial commit
This commit is contained in:
Tim Reichen 2024-08-30 02:02:13 +02:00 committed by GitHub
parent 15bf9115dd
commit d279c0a49a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 16 additions and 1 deletions

View File

@ -351,11 +351,14 @@ Deno.test({
assertEquals(
parse(`
- 0
- +0
- -0
- 42
- +42
- -42
- 1_000
`),
[0, 42, -42, 1000],
[0, 0, 0, 42, 42, -42, 1000],
);
// binary, octal, and hexadecimal

View File

@ -87,14 +87,26 @@ Deno.test({
stringify(42, { styles: { "!!int": "binary" } }),
"0b101010\n",
);
assertEquals(
stringify(-42, { styles: { "!!int": "binary" } }),
"-0b101010\n",
);
assertEquals(
stringify(42, { styles: { "!!int": "octal" } }),
"052\n",
);
assertEquals(
stringify(-42, { styles: { "!!int": "octal" } }),
"-052\n",
);
assertEquals(
stringify(42, { styles: { "!!int": "hexadecimal" } }),
"0x2A\n",
);
assertEquals(
stringify(-42, { styles: { "!!int": "hexadecimal" } }),
"-0x2A\n",
);
},
});