diff options
Diffstat (limited to 'test/bun.js/index-of-line.test.ts')
-rw-r--r-- | test/bun.js/index-of-line.test.ts | 37 |
1 files changed, 0 insertions, 37 deletions
diff --git a/test/bun.js/index-of-line.test.ts b/test/bun.js/index-of-line.test.ts deleted file mode 100644 index 1c6cbaea2..000000000 --- a/test/bun.js/index-of-line.test.ts +++ /dev/null @@ -1,37 +0,0 @@ -import { expect, test } from "bun:test"; -import { indexOfLine } from "bun"; - -test("indexOfLine", () => { - const source = ` - const a = 1; - - const b = 2; - - ๐const c = 3; // handles unicode - - ๐ Get Emoji โ All Emojis to โ๏ธ - - const b = 2; - - const c = 3; -`; - var i = 0; - var j = 0; - const buffer = Buffer.from(source); - var nonEmptyLineCount = 0; - while (i < buffer.length) { - const prev = j; - j = source.indexOf("\n", j); - i = indexOfLine(buffer, i); - - const delta = Buffer.byteLength(source.slice(0, j), "utf8") - j; - console.log(source.slice(prev + 1, j)); - if (i === -1) { - expect(j).toBe(-1); - expect(nonEmptyLineCount).toBe(6); - break; - } - expect(i++ - delta).toBe(j++); - nonEmptyLineCount++; - } -}); |