本文整理匯總了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);
示例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);
示例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);
}));
示例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());
});