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


TypeScript pr.fs类代码示例

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


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

示例1: suiteTeardown

 suiteTeardown(async () => {
   if (testEnv) {
     testEnv.teardown();
   }
   if (await fs.exists(compdb_cp_path)) {
     await fs.unlink(compdb_cp_path);
   }
 });
开发者ID:vector-of-bool,项目名称:vscode-cmake-tools,代码行数:8,代码来源:configure-and-build.test.ts

示例2: test

 test('Delete a file after stating', async () => {
   await fs.writeFile(test_file_path, 'dummy');
   const input = await InputFile.create(test_file_path);
   // We haven't changed it yet.
   expect(!await input.checkOutOfDate());
   await fs.unlink(test_file_path);
   // Removing a file is considered a modification
   expect(await input.checkOutOfDate());
   expect(false);
 });
开发者ID:vector-of-bool,项目名称:vscode-cmake-tools,代码行数:10,代码来源:dirty.test.ts

示例3: test

test('Copy compile_commands.json to a pre-determined path', async () => {
      expect(await fs.exists(compdb_cp_path), 'File shouldn\'t be there!').to.be.false;
      let retc = await cmt.configure();
      expect(retc).to.eq(0);
      expect(await fs.exists(compdb_cp_path), 'File still shouldn\'t be there').to.be.false;
      testEnv.config.updatePartial({copyCompileCommands: compdb_cp_path});
      retc = await cmt.configure();
      expect(retc).to.eq(0);
      expect(await fs.exists(compdb_cp_path), 'File wasn\'t copied').to.be.true;
    }).timeout(100000);
开发者ID:vector-of-bool,项目名称:vscode-cmake-tools,代码行数:10,代码来源:configure-and-build.test.ts

示例4: teardown

  teardown(async function(this: Mocha.IBeforeAndAfterContext) {
    const variantFileBackup = path.join(testEnv.projectFolder.location, '.vscode', 'cmake-variants.json');
    if (await fs.exists(variantFileBackup)) {
      const variantFile = path.join(testEnv.projectFolder.location, '.vscode', 'cmake-variants.json');
      await fs.rename(variantFileBackup, variantFile);
    }

    this.timeout(30000);
    await cmt.asyncDispose();
    testEnv.teardown();
  });
开发者ID:vector-of-bool,项目名称:vscode-cmake-tools,代码行数:11,代码来源:variant-envs.test.ts

示例5: create

 static async create(filePath: string): Promise<InputFile> {
   let stat: Stats;
   try {
     stat = await fs.stat(filePath);
   } catch (_) { return new InputFile(filePath, null); }
   return new InputFile(filePath, stat.mtime);
 }
开发者ID:vector-of-bool,项目名称:vscode-cmake-tools,代码行数:7,代码来源:dirty.ts

示例6: test

  test('Test scan of mingw', async () => {
    const kits = await scanForKits({
      scanDirs: [],
      minGWSearchDirs: mingw_dirs,
    });
    const is_kit_MinGW_present = kits.find(kit => kit.name.indexOf('GCC for i686-w64-mingw32 4.9.2') >= 0) ? true : false;
    const is_kit_MinGW_w64_present = kits.find(kit => kit.name.indexOf('GCC for x86_64-w64-mingw32 7.2.0') >= 0) ? true : false;
    console.log(JSON.stringify(kits, null, 2));

    if (await fs.exists(mingw_dirs[0])) {
      expect(is_kit_MinGW_present).to.equal(true);
    }
    if (await fs.exists(mingw_dirs[1])) {
      expect(is_kit_MinGW_w64_present).to.equal(true);
    }
  }).timeout(100000);
开发者ID:vector-of-bool,项目名称:vscode-cmake-tools,代码行数:16,代码来源:scan_kits.test.ts

示例7: test

  test('Replace default variant', async () => {
    const variantFile = path.join(testEnv.projectFolder.location, '.vscode', 'cmake-variants.json');
    const variantFileBackup = path.join(testEnv.projectFolder.location, '.vscode', 'cmake-variants.json.backup');
    await fs.rename(variantFile, variantFileBackup);
    expect(await fs.exists(variantFile)).to.be.false;

    // Set fake settings
    testEnv.config.updatePartial({
      defaultVariants: {
        buildType: {
          default: 'debug-label',
          choices: {
            'debug-label': {short: 'debug-label short', buildType: 'Debug'},
            'not-debug': {short: 'not-debug short', buildType: 'Release'}
          }
        },
        otherVariant: {
          default: 'option1',
          choices: {
            option1: {short: 'option1 short', env: {TEST_VARIANT_ENV: '0xCAFE'}},
            option2: {short: 'option2 short'}
          }
        }
      }
    });

    try {
      // Configure
      expect(await cmt.configure()).to.be.eq(0, '[variantEnv] 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('variantEnv');
      expect(cacheEntry_).to.not.be.eq(null, '[variantEnv] Cache entry was not present');
      const cacheEntry = cacheEntry_!;
      expect(cacheEntry.type).to.eq(api.CacheEntryType.String, '[variantEnv] unexpected cache entry type');
      expect(cacheEntry.key).to.eq('variantEnv', '[variantEnv] unexpected cache entry key name');
      expect(typeof cacheEntry.value).to.eq('string', '[variantEnv] unexpected cache entry value type');
      expect(cacheEntry.as<string>()).to.eq('0xCAFE', '[variantEnv] incorrect environment variable');
    } finally {
      // Restore the vairants file to before the test
      await fs.rename(variantFileBackup, variantFile);
    }
  }).timeout(100000);
开发者ID:vector-of-bool,项目名称:vscode-cmake-tools,代码行数:44,代码来源:variant-envs.test.ts

示例8: checkOutOfDate

 async checkOutOfDate(): Promise<boolean> {
   if (this.mtime === null) {
     return true;
   }
   let stat: Stats;
   try {
     stat = await fs.stat(this.filePath);
   } catch (_) {
     // Failed to stat: Treat the file as out-of-date
     return true;
   }
   return stat.mtime.valueOf() > this.mtime.valueOf();
 }
开发者ID:vector-of-bool,项目名称:vscode-cmake-tools,代码行数:13,代码来源:dirty.ts


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