package scotch.compiler.parser;
import static java.util.Arrays.asList;
import static org.hamcrest.Matchers.hasKey;
import static org.hamcrest.Matchers.hasSize;
import static org.junit.Assert.assertThat;
import java.util.List;
import java.util.Map;
import org.junit.Test;
import scotch.compiler.parser.ScotchParser.ModuleContext;
public class ModulesMapperTest extends ScotchParserBaseTest {
@Test
public void shouldMapModules() {
Map<String, List<ModuleContext>> map = new ModulesMapper().map(asList(
parseTree(ScotchParser::modules,
"module a.b.c",
"module x.y.z",
"module a.b.c"
)
));
assertThat(map, hasKey("a.b.c"));
assertThat(map, hasKey("x.y.z"));
assertThat(map.get("a.b.c"), hasSize(2));
assertThat(map.get("x.y.z"), hasSize(1));
}
}