From 21e6176d08718f7d82b505c607466e45e5971d71 Mon Sep 17 00:00:00 2001 From: fromwheretowhere Date: Mon, 11 May 2020 22:25:02 -0700 Subject: [PATCH] =?UTF-8?q?#8=20=E6=B7=BB=E5=8A=A0=E7=AE=80=E5=8D=95?= =?UTF-8?q?=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/suite/extension.test.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/test/suite/extension.test.js b/test/suite/extension.test.js index 34249bb..1ca3c26 100755 --- a/test/suite/extension.test.js +++ b/test/suite/extension.test.js @@ -4,15 +4,21 @@ const { before } = require('mocha'); // You can import and use all API from the 'vscode' module // as well as import your extension to test it const vscode = require('vscode'); -// const myExtension = require('../extension'); +// const 补全实现 = require('../../补全实现') // TODO: 应直接引用模块 +// 拷贝自"补全实现" +const 标识符模式 = /(-?\d*\.\d\w*)|([^\`\~\!\@\^\&\*\(\)\=\+\[\{\]\}\\\|\;\:\'\"\,\.\<\>\/\s?。,、;:?…—·ˉˇ¨“”~〃|《》〔〕(),]+)/g; suite('Extension Test Suite', () => { before(() => { vscode.window.showInformationMessage('Start all tests.'); }); - test('Sample test', () => { - assert.equal(-1, [1, 2, 3].indexOf(5)); - assert.equal(-1, [1, 2, 3].indexOf(0)); + test('标识符识别', () => { + assert.deepEqual("量 - 1".match(标识符模式), ["量", "-", "1"]); + + // 复现 https://github.com/program-in-chinese/vscode_Chinese_Input_Assistant/issues/8 + assert.deepEqual("量-1".match(标识符模式), ["量-1"], "现状有误"); + // TODO: 下面应通过 + assert.deepEqual("量-1".match(标识符模式), ["量", "-", "1"], "与-相连"); }); });