Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Akirathan committed Mar 5, 2025
1 parent e43f350 commit c19b7b4
Showing 1 changed file with 19 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public void resolveSingleName_FromSingleImport() throws IOException {
projDir,
bindingsMap -> {
assertSingleResolvedType(bindingsMap, "My_Vector");
assertSingleResolvedType(bindingsMap, "local.Proj.My_Vector.My_Vector");
});
}

Expand All @@ -48,15 +49,6 @@ public void resolveSingleName_FromSingleImportWithFrom() throws IOException {
projDir,
bindingsMap -> {
assertSingleResolvedType(bindingsMap, "My_Vector");
});
}

@Test
public void resolveQualifiedName_FromSingleImport() throws IOException {
var projDir = createProject("import local.Proj.My_Vector.My_Vector");
testBindingsMap(
projDir,
bindingsMap -> {
assertSingleResolvedType(bindingsMap, "local.Proj.My_Vector.My_Vector");
});
}
Expand All @@ -81,6 +73,7 @@ public void resolveQualifiedName_FromSingleImport_TwoProjects() throws IOExcepti
testBindingsMap(
projDir,
bindingsMap -> {
assertSingleResolvedType(bindingsMap, "My_Vector");
assertSingleResolvedType(bindingsMap, "local.Lib.My_Vector.My_Vector");
});
}
Expand Down Expand Up @@ -151,19 +144,21 @@ public void resolveExportedType() throws IOException {
new SourceModule(
QualifiedName.fromString("My_Module"),
"""
type My_Type
Cons
"""),
type My_Type
Cons
"""),
new SourceModule(
QualifiedName.fromString("Main"),
"""
export project.My_Module.My_Type
""")),
import project.My_Module.My_Type
export project.My_Module.My_Type
""")),
projDir);
testBindingsMap(
projDir,
bindingsMap -> {
assertSingleResolvedType(bindingsMap, "My_Type");
assertSingleResolvedType(bindingsMap, "local.Proj.My_Module.My_Type");
});
}

Expand All @@ -177,13 +172,18 @@ public void resolveReexportedType() throws IOException {
ProjectUtils.createProject(
"Lib",
Set.of(
new SourceModule(QualifiedName.fromString("Main"), "export project.My_Module.My_Type"),
new SourceModule(
QualifiedName.fromString("Main"),
"""
import project.My_Module.My_Type
export project.My_Module.My_Type
"""),
new SourceModule(
QualifiedName.fromString("My_Module"),
"""
type My_Type
Cons
""")),
type My_Type
Cons
""")),
libDir);
ProjectUtils.createProject(
"Proj",
Expand All @@ -192,6 +192,7 @@ public void resolveReexportedType() throws IOException {
testBindingsMap(
projDir,
bindingsMap -> {
assertSingleResolvedType(bindingsMap, "My_Type");
assertSingleResolvedType(bindingsMap, "local.Lib.My_Module.My_Type");
});
}
Expand Down Expand Up @@ -256,14 +257,12 @@ private static void testBindingsMap(
}
}

// TODO: Extract from ExportedSymbolsTest
private static Context createCtx(Path projDir) {
return ContextUtils.defaultContextBuilder()
.option(RuntimeOptions.PROJECT_ROOT, projDir.toAbsolutePath().toString())
.build();
}

// TODO: Extract
private static void compile(Context ctx) {
new PolyglotContext(ctx).getTopScope().compile(true);
}
Expand Down

0 comments on commit c19b7b4

Please sign in to comment.