Skip to content

Commit

Permalink
fixes error that prevented namespaces being correctly resolved
Browse files Browse the repository at this point in the history
  • Loading branch information
georgejecook committed Oct 25, 2023
1 parent 10f6305 commit 9dcfa58
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 7 deletions.
4 changes: 2 additions & 2 deletions bsc-plugin/src/lib/rooibos/MockUtil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export class MockUtil {
}

// console.log('processing stubbed method', methodName);
//TODO check if the user has actually mocked or stubbed this function, otherwise leave it alone!
// TODO check if the user has actually mocked or stubbed this function, otherwise leave it alone!

for (let param of functionStatement.func.parameters) {
param.asToken = null;
Expand Down Expand Up @@ -142,7 +142,7 @@ export class MockUtil {
walkMode: brighterscript.WalkMode.visitStatementsRecursive
});
} catch (e) {
// console.log(e);
console.log(e);
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
diagnosticErrorProcessingFile(testSuite.file, e.message);
}
Expand Down
16 changes: 13 additions & 3 deletions bsc-plugin/src/lib/rooibos/RooibosSession.ts
Original file line number Diff line number Diff line change
Expand Up @@ -227,11 +227,21 @@ export class RooibosSession {

private getNamespaces(program: Program) {
let scopeNamespaces = new Map<string, NamespaceContainer>();
for (const files of Object.values(program.files)) {
let processedScopes = new Set<string>();

for (let scope of program.getScopesForFile(files)) {
for (const file of Object.values(program.files)) {

for (let scope of program.getScopesForFile(file)) {
if (processedScopes.has(scope.dependencyGraphKey)) {
// Skip this scope if it has already been processed
continue;
}
let scopeMap = this.getNamespaceLookup(scope);
scopeNamespaces = new Map<string, NamespaceContainer>([...Array.from(scopeMap.entries())]);
// scopeNamespaces = new Map<string, NamespaceContainer>([...Array.from(scopeMap.entries())]);
for (let [key, value] of scopeMap.entries()) {
scopeNamespaces.set(key, value);
}
processedScopes.add(scope.dependencyGraphKey);
}
}
return scopeNamespaces;
Expand Down
4 changes: 2 additions & 2 deletions tests/src/source/NewExpectSyntax.spec.bs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace tests
isFail = m.currentResult.isFail
m.currentResult.Reset()
m.cleanMocks()
m.cleanSTubs()
m.cleanStubs()
m.assertTrue(isFail)
end function

Expand All @@ -26,7 +26,7 @@ namespace tests
isFail = m.currentResult.isFail
m.currentResult.Reset()
m.cleanMocks()
m.cleanSTubs()
m.cleanStubs()
m.assertFalse(isFail)
end function

Expand Down

0 comments on commit 9dcfa58

Please sign in to comment.