mirror of
https://github.com/denoland/std.git
synced 2024-11-21 20:50:22 +00:00
test(log): cleaunp TextDecoder
use (#5407)
tests(log): cleaunp `TextDecoder` use
This commit is contained in:
parent
a32c05fe26
commit
10bcb95c9f
@ -12,9 +12,7 @@ Deno.test({
|
||||
class TestFileHandler extends FileHandler {
|
||||
override flush() {
|
||||
super.flush();
|
||||
const decoder = new TextDecoder("utf-8");
|
||||
const data = Deno.readFileSync(LOG_FILE);
|
||||
const text = decoder.decode(data);
|
||||
const text = Deno.readTextFileSync(LOG_FILE);
|
||||
assertEquals(text.slice(-1), "\n");
|
||||
}
|
||||
|
||||
|
@ -204,20 +204,10 @@ Deno.test({
|
||||
); // 'ERROR AAA\n' = 10 bytes
|
||||
fileHandler.destroy();
|
||||
|
||||
const decoder = new TextDecoder();
|
||||
assertEquals(decoder.decode(Deno.readFileSync(LOG_FILE)), "ERROR AAA\n");
|
||||
assertEquals(
|
||||
decoder.decode(Deno.readFileSync(LOG_FILE + ".1")),
|
||||
"original log file",
|
||||
);
|
||||
assertEquals(
|
||||
decoder.decode(Deno.readFileSync(LOG_FILE + ".2")),
|
||||
"original log.1 file",
|
||||
);
|
||||
assertEquals(
|
||||
decoder.decode(Deno.readFileSync(LOG_FILE + ".3")),
|
||||
"original log.2 file",
|
||||
);
|
||||
assertEquals(Deno.readTextFileSync(LOG_FILE), "ERROR AAA\n");
|
||||
assertEquals(Deno.readTextFileSync(LOG_FILE + ".1"), "original log file");
|
||||
assertEquals(Deno.readTextFileSync(LOG_FILE + ".2"), "original log.1 file");
|
||||
assertEquals(Deno.readTextFileSync(LOG_FILE + ".3"), "original log.2 file");
|
||||
assert(!existsSync(LOG_FILE + ".4"));
|
||||
|
||||
Deno.removeSync(LOG_FILE);
|
||||
|
Loading…
Reference in New Issue
Block a user