|
15 | 15 |
|
16 | 16 | package software.amazon.smithy.lsp.ext; |
17 | 17 |
|
18 | | -import static org.junit.Assert.assertEquals; |
19 | | -import static org.junit.Assert.assertFalse; |
20 | | - |
21 | 18 | import java.io.File; |
22 | 19 | import java.nio.file.Files; |
23 | 20 | import java.nio.file.Path; |
|
43 | 40 | import software.amazon.smithy.utils.ListUtils; |
44 | 41 | import software.amazon.smithy.utils.MapUtils; |
45 | 42 |
|
| 43 | +import static org.junit.Assert.assertEquals; |
| 44 | +import static org.junit.Assert.assertFalse; |
| 45 | +import static org.junit.Assert.assertNotNull; |
| 46 | + |
46 | 47 | public class SmithyProjectTest { |
47 | 48 |
|
48 | 49 | @Test |
@@ -124,6 +125,30 @@ public void ignoresUnmodeledApplyStatements() throws Exception { |
124 | 125 | } |
125 | 126 | } |
126 | 127 |
|
| 128 | + // https://github.com/awslabs/smithy-language-server/issues/100 |
| 129 | + @Test |
| 130 | + public void allowsEmptyStructsWithMixins() throws Exception { |
| 131 | + String fileText = "$version: \"2\"\n" + |
| 132 | + "\n" + |
| 133 | + "namespace demo\n" + |
| 134 | + "\n" + |
| 135 | + "operation MyOp {\n" + |
| 136 | + " output: MyOpOutput\n" + |
| 137 | + "}\n" + |
| 138 | + "\n" + |
| 139 | + "@output\n" + |
| 140 | + "structure MyOpOutput {}\n"; |
| 141 | + |
| 142 | + Map<String, String> files = MapUtils.of("main.smithy", fileText); |
| 143 | + |
| 144 | + try (Harness hs = Harness.create(SmithyBuildExtensions.builder().build(), files)) { |
| 145 | + assertNotNull(hs.getProject()); |
| 146 | + Map<ShapeId, Location> locationMap = hs.getProject().getLocations(); |
| 147 | + |
| 148 | + correctLocation(locationMap, "demo#MyOpOutput", 9, 0, 9, 23); |
| 149 | + } |
| 150 | + } |
| 151 | + |
127 | 152 | @Test |
128 | 153 | public void definitionLocationsV1() throws Exception { |
129 | 154 | Path baseDir = Paths.get(SmithyProjectTest.class.getResource("models/v1").toURI()); |
|
0 commit comments