mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
Merge from vscode bead496a613e475819f89f08e9e882b841bc1fe8 (#14883)
* Merge from vscode bead496a613e475819f89f08e9e882b841bc1fe8 * Bump distro * Upgrade GCC to 4.9 due to yarn install errors * Update build image * Fix bootstrap base url * Bump distro * Fix build errors * Update source map file * Disable checkbox for blocking migration issues (#15131) * disable checkbox for blocking issues * wip * disable checkbox fixes * fix strings * Remove duplicate tsec command * Default to off for tab color if settings not present * re-skip failing tests * Fix mocha error * Bump sqlite version & fix notebooks search view * Turn off esbuild warnings * Update esbuild log level * Fix overflowactionbar tests * Fix ts-ignore in dropdown tests * cleanup/fixes * Fix hygiene * Bundle in entire zone.js module * Remove extra constructor param * bump distro for web compile break * bump distro for web compile break v2 * Undo log level change * New distro * Fix integration test scripts * remove the "no yarn.lock changes" workflow * fix scripts v2 * Update unit test scripts * Ensure ads-kerberos2 updates in .vscodeignore * Try fix unit tests * Upload crash reports * remove nogpu * always upload crashes * Use bash script * Consolidate data/ext dir names * Create in tmp directory Co-authored-by: chlafreniere <hichise@gmail.com> Co-authored-by: Christopher Suh <chsuh@microsoft.com> Co-authored-by: chgagnon <chgagnon@microsoft.com>
This commit is contained in:
@@ -28,16 +28,8 @@ suite('ContextKeyExpr', () => {
|
||||
ContextKeyExpr.notEquals('c2', 'cc2'),
|
||||
ContextKeyExpr.not('d1'),
|
||||
ContextKeyExpr.not('d2'),
|
||||
ContextKeyExpr.greaterThanEquals('e1', 'ee1'), // {{SQL CARBON EDIT}} add test case
|
||||
ContextKeyExpr.greaterThanEquals('e2', 'ee2'), // {{SQL CARBON EDIT}} add test case
|
||||
ContextKeyExpr.lessThanEquals('f1', 'ff1'), // {{SQL CARBON EDIT}} add test case
|
||||
ContextKeyExpr.lessThanEquals('f2', 'ff2'), // {{SQL CARBON EDIT}} add test case
|
||||
)!;
|
||||
let b = ContextKeyExpr.and(
|
||||
ContextKeyExpr.lessThanEquals('f1', 'ff1'), // {{SQL CARBON EDIT}}
|
||||
ContextKeyExpr.lessThanEquals('f2', 'ff2'), // {{SQL CARBON EDIT}}
|
||||
ContextKeyExpr.greaterThanEquals('e2', 'ee2'), // {{SQL CARBON EDIT}}
|
||||
ContextKeyExpr.greaterThanEquals('e1', 'ee1'), // {{SQL CARBON EDIT}}
|
||||
ContextKeyExpr.equals('b2', 'bb2'),
|
||||
ContextKeyExpr.notEquals('c1', 'cc1'),
|
||||
ContextKeyExpr.not('d1'),
|
||||
@@ -75,7 +67,7 @@ suite('ContextKeyExpr', () => {
|
||||
function testExpression(expr: string, expected: boolean): void {
|
||||
// console.log(expr + ' ' + expected);
|
||||
let rules = ContextKeyExpr.deserialize(expr);
|
||||
assert.equal(rules!.evaluate(context), expected, expr);
|
||||
assert.strictEqual(rules!.evaluate(context), expected, expr);
|
||||
}
|
||||
function testBatch(expr: string, value: any): void {
|
||||
/* eslint-disable eqeqeq */
|
||||
@@ -165,17 +157,17 @@ suite('ContextKeyExpr', () => {
|
||||
|
||||
test('ContextKeyInExpr', () => {
|
||||
const ainb = ContextKeyExpr.deserialize('a in b')!;
|
||||
assert.equal(ainb.evaluate(createContext({ 'a': 3, 'b': [3, 2, 1] })), true);
|
||||
assert.equal(ainb.evaluate(createContext({ 'a': 3, 'b': [1, 2, 3] })), true);
|
||||
assert.equal(ainb.evaluate(createContext({ 'a': 3, 'b': [1, 2] })), false);
|
||||
assert.equal(ainb.evaluate(createContext({ 'a': 3 })), false);
|
||||
assert.equal(ainb.evaluate(createContext({ 'a': 3, 'b': null })), false);
|
||||
assert.equal(ainb.evaluate(createContext({ 'a': 'x', 'b': ['x'] })), true);
|
||||
assert.equal(ainb.evaluate(createContext({ 'a': 'x', 'b': ['y'] })), false);
|
||||
assert.equal(ainb.evaluate(createContext({ 'a': 'x', 'b': {} })), false);
|
||||
assert.equal(ainb.evaluate(createContext({ 'a': 'x', 'b': { 'x': false } })), true);
|
||||
assert.equal(ainb.evaluate(createContext({ 'a': 'x', 'b': { 'x': true } })), true);
|
||||
assert.equal(ainb.evaluate(createContext({ 'a': 'prototype', 'b': {} })), false);
|
||||
assert.strictEqual(ainb.evaluate(createContext({ 'a': 3, 'b': [3, 2, 1] })), true);
|
||||
assert.strictEqual(ainb.evaluate(createContext({ 'a': 3, 'b': [1, 2, 3] })), true);
|
||||
assert.strictEqual(ainb.evaluate(createContext({ 'a': 3, 'b': [1, 2] })), false);
|
||||
assert.strictEqual(ainb.evaluate(createContext({ 'a': 3 })), false);
|
||||
assert.strictEqual(ainb.evaluate(createContext({ 'a': 3, 'b': null })), false);
|
||||
assert.strictEqual(ainb.evaluate(createContext({ 'a': 'x', 'b': ['x'] })), true);
|
||||
assert.strictEqual(ainb.evaluate(createContext({ 'a': 'x', 'b': ['y'] })), false);
|
||||
assert.strictEqual(ainb.evaluate(createContext({ 'a': 'x', 'b': {} })), false);
|
||||
assert.strictEqual(ainb.evaluate(createContext({ 'a': 'x', 'b': { 'x': false } })), true);
|
||||
assert.strictEqual(ainb.evaluate(createContext({ 'a': 'x', 'b': { 'x': true } })), true);
|
||||
assert.strictEqual(ainb.evaluate(createContext({ 'a': 'prototype', 'b': {} })), false);
|
||||
});
|
||||
|
||||
test('issue #106524: distributing AND should normalize', () => {
|
||||
@@ -196,6 +188,86 @@ suite('ContextKeyExpr', () => {
|
||||
ContextKeyExpr.has('c')
|
||||
)
|
||||
);
|
||||
assert.equal(actual!.equals(expected!), true);
|
||||
assert.strictEqual(actual!.equals(expected!), true);
|
||||
});
|
||||
|
||||
test('Greater, GreaterEquals, Smaller, SmallerEquals evaluate', () => {
|
||||
function checkEvaluate(expr: string, ctx: any, expected: any): void {
|
||||
const _expr = ContextKeyExpr.deserialize(expr)!;
|
||||
assert.strictEqual(_expr.evaluate(createContext(ctx)), expected);
|
||||
}
|
||||
|
||||
checkEvaluate('a>1', {}, false);
|
||||
checkEvaluate('a>1', { a: 0 }, false);
|
||||
checkEvaluate('a>1', { a: 1 }, false);
|
||||
checkEvaluate('a>1', { a: 2 }, true);
|
||||
checkEvaluate('a>1', { a: '0' }, false);
|
||||
checkEvaluate('a>1', { a: '1' }, false);
|
||||
checkEvaluate('a>1', { a: '2' }, true);
|
||||
checkEvaluate('a>1', { a: 'a' }, false);
|
||||
|
||||
checkEvaluate('a>10', { a: 2 }, false);
|
||||
checkEvaluate('a>10', { a: 11 }, true);
|
||||
checkEvaluate('a>10', { a: '11' }, true);
|
||||
checkEvaluate('a>10', { a: '2' }, false);
|
||||
checkEvaluate('a>10', { a: '11' }, true);
|
||||
|
||||
checkEvaluate('a>1.1', { a: 1 }, false);
|
||||
checkEvaluate('a>1.1', { a: 2 }, true);
|
||||
checkEvaluate('a>1.1', { a: 11 }, true);
|
||||
checkEvaluate('a>1.1', { a: '1.1' }, false);
|
||||
checkEvaluate('a>1.1', { a: '2' }, true);
|
||||
checkEvaluate('a>1.1', { a: '11' }, true);
|
||||
|
||||
checkEvaluate('a>b', { a: 'b' }, false);
|
||||
checkEvaluate('a>b', { a: 'c' }, false);
|
||||
checkEvaluate('a>b', { a: 1000 }, false);
|
||||
|
||||
checkEvaluate('a >= 2', { a: '1' }, false);
|
||||
checkEvaluate('a >= 2', { a: '2' }, true);
|
||||
checkEvaluate('a >= 2', { a: '3' }, true);
|
||||
|
||||
checkEvaluate('a < 2', { a: '1' }, true);
|
||||
checkEvaluate('a < 2', { a: '2' }, false);
|
||||
checkEvaluate('a < 2', { a: '3' }, false);
|
||||
|
||||
checkEvaluate('a <= 2', { a: '1' }, true);
|
||||
checkEvaluate('a <= 2', { a: '2' }, true);
|
||||
checkEvaluate('a <= 2', { a: '3' }, false);
|
||||
});
|
||||
|
||||
test('Greater, GreaterEquals, Smaller, SmallerEquals negate', () => {
|
||||
function checkNegate(expr: string, expected: string): void {
|
||||
const a = ContextKeyExpr.deserialize(expr)!;
|
||||
const b = a.negate();
|
||||
assert.strictEqual(b.serialize(), expected);
|
||||
}
|
||||
|
||||
checkNegate('a>1', 'a <= 1');
|
||||
checkNegate('a>1.1', 'a <= 1.1');
|
||||
checkNegate('a>b', 'a <= b');
|
||||
|
||||
checkNegate('a>=1', 'a < 1');
|
||||
checkNegate('a>=1.1', 'a < 1.1');
|
||||
checkNegate('a>=b', 'a < b');
|
||||
|
||||
checkNegate('a<1', 'a >= 1');
|
||||
checkNegate('a<1.1', 'a >= 1.1');
|
||||
checkNegate('a<b', 'a >= b');
|
||||
|
||||
checkNegate('a<=1', 'a > 1');
|
||||
checkNegate('a<=1.1', 'a > 1.1');
|
||||
checkNegate('a<=b', 'a > b');
|
||||
});
|
||||
|
||||
test('issue #111899: context keys can use `<` or `>` ', () => {
|
||||
const actual = ContextKeyExpr.deserialize('editorTextFocus && vim.active && vim.use<C-r>')!;
|
||||
assert.ok(actual.equals(
|
||||
ContextKeyExpr.and(
|
||||
ContextKeyExpr.has('editorTextFocus'),
|
||||
ContextKeyExpr.has('vim.active'),
|
||||
ContextKeyExpr.has('vim.use<C-r>'),
|
||||
)!
|
||||
));
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user