test leftover string printing

This commit is contained in:
DavidVentura
2024-01-26 13:56:50 +01:00
parent 83e5a7de52
commit 1963f06790
+8 -1
View File
@@ -2,9 +2,10 @@ import "../shim.ts";
import assert from "assert"; import assert from "assert";
import { placeholderTypes, sprintf } from "../utils.js";
import { XqBytesDec, XqBytesEnc } from "../func_replacements.js"; import { XqBytesDec, XqBytesEnc } from "../func_replacements.js";
import { SendUsrChk } from "../impl.ts"; import { SendUsrChk } from "../impl.ts";
import { placeholderTypes, sprintf } from "../utils.js";
import { hexdump } from "../hexdump.js";
describe("debug_tools", () => { describe("debug_tools", () => {
it("parses printed data", () => { it("parses printed data", () => {
@@ -19,6 +20,12 @@ describe("debug_tools", () => {
const expected_string = "string: potato, int: 5, float: 3.5, hexint: 0x20, newline: \n\n last int: 999"; const expected_string = "string: potato, int: 5, float: 3.5, hexint: 0x20, newline: \n\n last int: 999";
assert.deepEqual(sprintf(fmt, in_values), expected_string); assert.deepEqual(sprintf(fmt, in_values), expected_string);
}); });
it("prints leftover after last formatter", () => {
const fmt = "string: %s and this bit is also printed";
const in_values = ["potato"];
const expected_string = "string: potato and this bit is also printed";
assert.deepEqual(sprintf(fmt, in_values), expected_string);
});
}); });
describe("module", () => { describe("module", () => {