Skip to content

Commit

Permalink
Merge branch 'generator-source-maps' of https://github.com/Safe-DS/DSL
Browse files Browse the repository at this point in the history
…into generator-source-maps

# Conflicts:
#	packages/safe-ds-lang/tests/helpers/testResources.ts
#	packages/safe-ds-lang/tests/language/generation/safe-ds-python-generator.test.ts
  • Loading branch information
WinPlay02 committed Nov 2, 2023
2 parents 7509405 + 43e8294 commit 6b87808
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions packages/safe-ds-lang/tests/helpers/testResources.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@ export const uriToShortenedTestResourceName = (
*/
export const listTestSafeDsFiles = (rootTestResourceName: TestResourceName): URI[] => {
const rootPath = testResourceNameToUri(rootTestResourceName).fsPath;
return listTestFilesWithExtensions(rootTestResourceName, SAFE_DS_FILE_EXTENSIONS).filter(uri => isNotSkipped(path.relative(rootPath, uri.fsPath)));
return listTestFilesWithExtensions(rootTestResourceName, SAFE_DS_FILE_EXTENSIONS).filter((uri) =>
isNotSkipped(path.relative(rootPath, uri.fsPath)),
);
};

/**
Expand All @@ -62,7 +64,7 @@ export const listTestSafeDsFiles = (rootTestResourceName: TestResourceName): URI
* @return URIs of the discovered files.
*/
export const listTestFilesWithExtensions = (rootTestResourceName: TestResourceName, extensions: string[]): URI[] => {
const pattern = extensions.length === 1 ? `**/*.${extensions[0]}` : `**/*.{${extensions.join(",")}}`;
const pattern = extensions.length === 1 ? `**/*.${extensions[0]}` : `**/*.{${extensions.join(',')}}`;
const cwd = testResourceNameToUri(rootTestResourceName).fsPath;

return globSync(pattern, { cwd, nodir: true }).map((it) => URI.file(path.join(cwd, it)));
Expand Down
2 changes: 1 addition & 1 deletion packages/safe-ds-lang/tests/language/generation/creator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ const createGenerationTest = async (parentDirectory: URI, inputUris: URI[]): Pro
* @param actualOutputRoot Where the actual output files supposed to be located.
*/
const readExpectedOutputFiles = (expectedOutputRoot: URI, actualOutputRoot: URI): ExpectedOutputFile[] => {
return listTestFilesWithExtensions(uriToShortenedTestResourceName(expectedOutputRoot), ["py", "map"]).map((uri) => {
return listTestFilesWithExtensions(uriToShortenedTestResourceName(expectedOutputRoot), ['py', 'map']).map((uri) => {
return {
uri: URI.file(path.join(actualOutputRoot.fsPath, path.relative(expectedOutputRoot.fsPath, uri.fsPath))),
code: fs.readFileSync(uri.fsPath).toString(),
Expand Down

0 comments on commit 6b87808

Please sign in to comment.