forked from DonJayamanne/pythonVSCode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcellMatcher.unit.test.ts
More file actions
26 lines (24 loc) · 1.32 KB
/
cellMatcher.unit.test.ts
File metadata and controls
26 lines (24 loc) · 1.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
'use strict';
import { assert } from 'chai';
import { IDataScienceSettings } from '../../client/common/types';
import { CellMatcher } from '../../client/datascience/cellMatcher';
import { defaultDataScienceSettings } from './helpers';
suite('Data Science CellMatcher', () => {
test('CellMatcher', () => {
const settings: IDataScienceSettings = defaultDataScienceSettings();
const matcher1 = new CellMatcher(settings);
assert.ok(matcher1.isCode('# %%'), 'Base code is wrong');
assert.ok(matcher1.isMarkdown('# %% [markdown]'), 'Base markdown is wrong');
assert.equal(matcher1.exec('# %% TITLE'), 'TITLE', 'Title not found');
settings.defaultCellMarker = '# %% CODE HERE';
const matcher2 = new CellMatcher(settings);
assert.ok(matcher2.isCode('# %%'), 'Code not found');
assert.ok(matcher2.isCode('# %% CODE HERE'), 'Code not found');
assert.ok(matcher2.isCode('# %% CODE HERE TOO'), 'Code not found');
assert.ok(matcher2.isMarkdown('# %% [markdown]'), 'Base markdown is wrong');
assert.equal(matcher2.exec('# %% CODE HERE'), '', 'Should not have a title');
assert.equal(matcher2.exec('# %% CODE HERE FOO'), 'FOO', 'Should have a title');
});
});