2017-10-02 11:08:34 -05:00
|
|
|
describe("write cursorOffset to stderr with --cursor-offset <int>", () => {
|
2023-04-11 08:44:23 +08:00
|
|
|
runCli("cli", ["--cursor-offset", "2", "--parser", "babel"], {
|
2018-05-23 16:55:06 -03:00
|
|
|
input: " 1",
|
|
|
|
|
}).test({
|
2017-10-02 11:08:34 -05:00
|
|
|
status: 0,
|
|
|
|
|
});
|
2017-09-09 12:06:50 +08:00
|
|
|
});
|
2017-10-11 00:32:45 -05:00
|
|
|
|
|
|
|
|
describe("cursorOffset should not be affected by full-width character", () => {
|
2023-04-11 08:44:23 +08:00
|
|
|
runCli("cli", ["--cursor-offset", "21", "--parser", "babel"], {
|
2020-01-14 18:58:20 +08:00
|
|
|
input:
|
|
|
|
|
'const x = ["中文", "中文", "中文", "中文", "中文", "中文", "中文", "中文", "中文", "中文", "中文"];',
|
2017-10-11 00:32:45 -05:00
|
|
|
// ^ offset = 21 ^ width = 80
|
|
|
|
|
}).test({
|
|
|
|
|
/**
|
|
|
|
|
* const x = [
|
|
|
|
|
* "中文",
|
|
|
|
|
* "中文",
|
|
|
|
|
* ^ offset = 26
|
|
|
|
|
* "中文",
|
|
|
|
|
* "中文",
|
|
|
|
|
* "中文",
|
|
|
|
|
* "中文",
|
|
|
|
|
* "中文",
|
|
|
|
|
* "中文",
|
|
|
|
|
* "中文",
|
|
|
|
|
* "中文",
|
|
|
|
|
* "中文"
|
|
|
|
|
* ];
|
|
|
|
|
*/
|
2023-03-30 14:25:28 +08:00
|
|
|
stderr: "26",
|
2017-10-11 00:32:45 -05:00
|
|
|
status: 0,
|
|
|
|
|
});
|
|
|
|
|
});
|