Skip to content

Commit

Permalink
test(lib/file): check EOL at the end of file
Browse files Browse the repository at this point in the history
  • Loading branch information
hasundue committed Mar 21, 2024
1 parent 23026fd commit c9981e5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/file_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
ReadTextFileStub,
WriteTextFileStub,
} from "./testing.ts";
import { assertInstanceOf } from "./std/assert.ts";
import { assert, assertInstanceOf } from "./std/assert.ts";
import { assertSnapshot } from "./testing.ts";
import { collect, CollectResult } from "./update.ts";
import { associateByFile, type FileUpdate, writeFileUpdate } from "./file.ts";
Expand Down Expand Up @@ -86,6 +86,9 @@ function test(path: string, name = toName(path)) {
if (result) {
await writeFileUpdate(updates);
await assertFileSystemSnapshot(t, fs);
for await (const content of fs.values()) {
assert(content.endsWith("\n"), "should end with a newline");
}
}
});
});
Expand Down
1 change: 1 addition & 0 deletions lib/std/assert.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export { assert } from "https://deno.land/std@0.219.1/assert/assert.ts";
export { assertArrayIncludes } from "https://deno.land/std@0.219.1/assert/assert_array_includes.ts";
export { assertEquals } from "https://deno.land/std@0.219.1/assert/assert_equals.ts";
export { assertExists } from "https://deno.land/std@0.219.1/assert/assert_exists.ts";
Expand Down

0 comments on commit c9981e5

Please sign in to comment.