• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript testing.it函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了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;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript tried.fuckFrom函数代码示例发布时间:2022-05-25
下一篇:
TypeScript testing.expect函数代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap