當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript testing.it函數代碼示例

本文整理匯總了TypeScript中basic/testing.it函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript it函數的具體用法?TypeScript it怎麽用?TypeScript it使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了it函數的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: describe

describe('compiling', function () {
    it('works s', function () {
        compiling('(10, void 0)').standardly()
            .overTo(expecting).beOk()
            .overTo(querying).files().without('lib.d.ts').first().dare('Unable to get a source file.')
            .nodes().at(1).dare('').overTo(tracing).log('Node');
    });
});
開發者ID:aleksey-bykov,項目名稱:linting,代碼行數:8,代碼來源:compiling-spec.ts

示例2: describe

describe('reading clusions', function () {
    it('succeeds with a valid regexp pattern as string', function () {
        const actual = readClusion('\\.d\\.ts');
        expect(actual.length).toBe(1);
        expect(bt.beLuck(actual[0]!).luck.source).toBe('\\.d\\.ts');
    });
    it('fails with an invalid regexp pattern as string', function () {
        const actual = readClusion('(');
        expect(actual.length).toBe(1);
        expect(bt.beFuck(actual[0]!).fuck).toBe('Value cannot be parsed as a regexp.');
    });
    it('succeeds with an array of valid regexp patterns as strings', function () {
        const actual = readClusion(['a', 'b']);
        expect(actual.length).toBe(2);
        expect(bt.beLuck(actual[0]!).luck.source).toBe('a');
        expect(bt.beLuck(actual[1]!).luck.source).toBe('b');
    });
});
開發者ID:aleksey-bykov,項目名稱:linting,代碼行數:18,代碼來源:file-filter-spec.ts

示例3: it

import { betterBeIssues } from "linting/asserting";
import { it } from "basic/testing";
import { building } from "linting/building";
import rule from 'rules/no-constant-lambdas/rule';

it('no lambdas returning number literal', function () {
    betterBeIssues(`
            function run<T>(toValue: () => T): T { return toValue(); };
            run(() => 1);
        `,
        building().stateless(rule).node().file().rule, {}, {},
        [{topic: 'no-literal-lambdas', message: 'literal returned'}]
    );
});

it('no lambdas returning string literal', function () {
    betterBeIssues(`
            function run<T>(toValue: () => T): T { return toValue(); };
            run(() => '');
        `,
        building().stateless(rule).node().file().rule, {}, {},
        [{topic: 'no-literal-lambdas', message: 'literal returned'}]
    );
});

it('no lambdas returning null', function () {
    betterBeIssues(`
            function run<T>(toValue: () => T): T { return toValue(); };
            run(() => null);
        `,
        building().stateless(rule).node().file().rule, {}, {},
開發者ID:aleksey-bykov,項目名稱:rules,代碼行數:31,代碼來源:rule-spec.ts

示例4: describe

describe('a loose parser', function () {
    it('reads empty input', function () {
        const parsed = readLoosely('', noCommands);
        expecting(parsed).haveNoArgs().haveNoCommands();
    });

    // commands
    it('reads a sole command', function () {
        const parsed = readLoosely('run', oneCommand);
        expecting(parsed).haveCommands(['run']).haveNoArgs();
    });
    it('fails at a command if no commands are intended', function () {
        const parsed = readLoosely('run', noCommands);
        expecting(parsed).beFailedDueTo(unexpectedCommand);
    });

    // sole short param

    it('reads a sole short flag parameter', function () {
        const parsed = readLoosely('-f', noCommands);
        expecting(parsed).haveShortArgs({ 'f': undefined }).haveNoFullArgs().haveNoCommands();
    });

    it('reads a sole short parameter with a value', function () {
        const parsed = readLoosely('-p test', noCommands);
        expecting(parsed).haveShortArgs({ 'p': 'test' }).haveNoFullArgs().haveNoCommands();
    });

    it('reads a short sole parameter with a double-quoted value', function () {
        const parsed = readLoosely('-p "many words"', noCommands);
        expecting(parsed).haveShortArgs({ 'p': 'many words' }).haveNoFullArgs().haveNoCommands();
    });
    it('reads a short sole parameter with a double-quoted value with a double-quote in it', function () {
        const parsed = readLoosely('-p """try ""value"""', noCommands);
        expecting(parsed).haveShortArgs({ 'p': '"try "value"' }).haveNoFullArgs().haveNoCommands();
    });

    // full sole param

    it('reads a sole full flag parameter', function () {
        const parsed = readLoosely('--flag', noCommands);
        expecting(parsed).haveFullArgs({ 'flag': undefined }).haveNoShortArgs().haveNoCommands();
    });

    it('reads a sole full parameter with a value', function () {
        const parsed = readLoosely('--param test', noCommands);
        expecting(parsed).haveFullArgs({ 'param': 'test' }).haveNoShortArgs().haveNoCommands();
    });

    it('reads a sole full parameter with a double-quoted value', function () {
        const parsed = readLoosely('--param "value"', noCommands);
        expecting(parsed).haveFullArgs({ 'param': 'value' }).haveNoShortArgs().haveNoCommands();
    });

    it('reads a sole full parameter with a double-quoted value with a double-quote in it', function () {
        const parsed = readLoosely('--param """try ""value"""', noCommands);
        expecting(parsed).haveFullArgs({ 'param': '"try "value"' }).haveNoShortArgs().haveNoCommands();
    });

    // full multiple params

    it('reads multiple full flag parameter', function () {
        const parsed = readLoosely('--flag --toggler --switch', noCommands);
        expecting(parsed).haveFullArgs({ 'flag': undefined, 'toggler': undefined, 'switch': undefined }).haveNoShortArgs().haveNoCommands();
    });

    // multiples
    it('reads a short flag parameter amid others', function () {
        const parsed = readLoosely('-f -t -s', noCommands);
        expecting(parsed).haveShortArgs({ 'f': undefined, 't': undefined, 's': undefined }).haveNoFullArgs().haveNoCommands();
    });

    it('fails at the same short parameter', function () {
        const parsed = readLoosely('-p once -p again', noCommands);
        expecting(parsed).beFailedDueTo(unexpectedParameterName);
    });
});
開發者ID:aleksey-bykov,項目名稱:commandlining,代碼行數:77,代碼來源:loose-builder-spec.ts


注:本文中的basic/testing.it函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。