Skip to content
This repository has been archived by the owner on Jul 14, 2020. It is now read-only.

Commit

Permalink
#8 添加简单测试
Browse files Browse the repository at this point in the history
  • Loading branch information
testacount1 committed May 12, 2020
1 parent 2699d89 commit 21e6176
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions test/suite/extension.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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"], "与-相连");
});
});

0 comments on commit 21e6176

Please sign in to comment.