当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript util.platformNormalizePath函数代码示例

本文整理汇总了TypeScript中@cmt/util.platformNormalizePath函数的典型用法代码示例。如果您正苦于以下问题:TypeScript platformNormalizePath函数的具体用法?TypeScript platformNormalizePath怎么用?TypeScript platformNormalizePath使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了platformNormalizePath函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: test

  test('Check substitution within toolchain kits', async () => {
    // Configure
    expect(await cmt.configure()).to.be.eq(0, '[toolchain] configure failed');
    expect(testEnv.projectFolder.buildDirectory.isCMakeCachePresent).to.eql(true, 'expected cache not present');
    const cache = await CMakeCache.fromPath(await cmt.cachePath);

    const cacheEntry = cache.get('CMAKE_TOOLCHAIN_FILE') as api.CacheEntry;
    // tslint:disable-next-line:no-unused-expression
    expect(cacheEntry).to.not.be.null;
    expect(cacheEntry.key).to.eq('CMAKE_TOOLCHAIN_FILE', '[toolchain] unexpected cache entry key name');
    expect(platformNormalizePath(cacheEntry.as<string>()))
        .to.eq(platformNormalizePath(testEnv.projectFolder.location.concat('/test-toolchain.cmake')),
               '[toolchain] substitution incorrect');
  }).timeout(100000);
开发者ID:vector-of-bool,项目名称:vscode-cmake-tools,代码行数:14,代码来源:toolchain.test.ts

示例2: test

  test('Check substitution for "workspaceFolder"', async () => {
    // Set fake settings
    testEnv.config.updatePartial({configureSettings: {workspaceFolder: '${workspaceFolder}'}});

    // Configure
    expect(await cmt.configure()).to.be.eq(0, '[workspaceFolder] configure failed');
    expect(testEnv.projectFolder.buildDirectory.isCMakeCachePresent).to.eql(true, 'expected cache not present');
    const cache = await CMakeCache.fromPath(await cmt.cachePath);

    const cacheEntry = cache.get('workspaceFolder') as api.CacheEntry;
    expect(cacheEntry.type).to.eq(api.CacheEntryType.String, '[workspaceFolder] unexpected cache entry type');
    expect(cacheEntry.key).to.eq('workspaceFolder', '[workspaceFolder] unexpected cache entry key name');
    expect(platformNormalizePath(cacheEntry.as<string>()))
        .to.eq(platformNormalizePath(testEnv.projectFolder.location), '[workspaceFolder] substitution incorrect');
    expect(typeof cacheEntry.value).to.eq('string', '[workspaceFolder] unexpected cache entry value type');
  }).timeout(100000);
开发者ID:vector-of-bool,项目名称:vscode-cmake-tools,代码行数:16,代码来源:variable-substitution.test.ts

示例3:

 = await Promise.all(util.map(util.flatMap(cmake_inputs.buildFiles, entry => entry.sources), src => {
     // Map input file paths to files relative to the source directory
     if (!path.isAbsolute(src)) {
       src = util.platformNormalizePath(path.join(cmake_inputs.sourceDirectory, src));
     }
     return InputFile.create(src);
   }));
开发者ID:vector-of-bool,项目名称:vscode-cmake-tools,代码行数:7,代码来源:dirty.ts

示例4: test

 test('Input file set maps files correctly', async () => {
   const foo_subdir = path.join(here, 'foo');
   const dummy_file = util.platformNormalizePath(path.join(foo_subdir, 'dummy_file'));
   const fileset = await InputFileSet.create({
     buildFiles: [{
       isCMake: false,
       isTemporary: false,
       sources: [
         'dummy_file',
         foo_subdir,
       ],
     }],
     cmakeRootDirectory: '', // unused
     sourceDirectory: foo_subdir,
   });
   expect(fileset.inputFiles).to.have.lengthOf(2, 'Wrong file count');
   // The relative path 'dummy_file' should have mapped to the full path to the correct file
   expect(fileset.inputFiles[0].filePath).to.eq(dummy_file, 'Filepath mapped incorrectly');
   // The absolute path `foo_subdir` should be kept as-is
   expect(fileset.inputFiles[1].filePath).to.eq(foo_subdir, 'Filepath mapped incorrectly');
   // Since the file doesn't exist, the fileset should tell us it is dirty
   expect(await fileset.checkOutOfDate());
 });
开发者ID:vector-of-bool,项目名称:vscode-cmake-tools,代码行数:23,代码来源:dirty.test.ts


注:本文中的@cmt/util.platformNormalizePath函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。