大修改
This commit is contained in:
1 parent
a1cbc9404a
commit
e81481623c
47 files changed
+1453
-285
No files matched your search
@@ -1,6 +1,7 @@
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { buildDataset } from './build';
|
||||
import { DEFAULT_DUMP_PATH, loadLegacyDump } from './load';
|
||||
import { readTable } from './parser';
|
||||
import {
|
||||
HOME_COURSE_TITLE_MAP,
|
||||
SETTINGS_KEY_MAP,
|
||||
@@ -153,3 +154,21 @@ describe('buildDataset(真实旧库数据)', () => {
|
||||
expect(all).toContain('https://data.example.com');
|
||||
});
|
||||
});
|
||||
|
||||
describe('readTable 换行兼容', () => {
|
||||
const lf = "INSERT INTO `t` VALUES (1,'a');\n";
|
||||
const crlf = "INSERT INTO `t` VALUES (1,'a');\r\nINSERT INTO `t` VALUES (2,'b');\r\n";
|
||||
|
||||
it('LF 换行的 dump 能解析', () => {
|
||||
expect(readTable(lf, 't')).toEqual([[1, 'a']]);
|
||||
});
|
||||
|
||||
// 回归:只匹配 \n 时,Windows 导出的 CRLF dump 会全部读成空数组,
|
||||
// 迁移会静默产出空数据(真实踩过)
|
||||
it('CRLF 换行的 dump 能解析(Windows 导出的格式)', () => {
|
||||
expect(readTable(crlf, 't')).toEqual([
|
||||
[1, 'a'],
|
||||
[2, 'b'],
|
||||
]);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user