当前位置: 首页>>代码示例>>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;未经允许,请勿转载。