-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add tests to assert that code outside com.dwolla.config doesn't have …
…access to the generated code
- Loading branch information
Showing
4 changed files
with
57 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
src/test/scala-2/bincompat/ShadedGeneratedSmithySpec.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package bincompat | ||
|
||
import munit.* | ||
|
||
class ShadedGeneratedSmithySpec extends FunSuite { | ||
test("we don't have access to the generated KMS objects in their original package") { | ||
assertNoDiff(compileErrors("""com.amazonaws.kms.KMS.id == smithy4s.ShapeId("com.amazonaws.kms", "TrentService")"""), | ||
"""error: object amazonaws is not a member of package com | ||
|com.amazonaws.kms.KMS.id == smithy4s.ShapeId("com.amazonaws.kms", "TrentService") | ||
| ^ | ||
|""".stripMargin) | ||
} | ||
|
||
test("we don't have access to the generated KMS objects in the shaded package") { | ||
assertNoDiff(compileErrors("""assertEquals(com.dwolla.config.smithy_shaded.com.amazonaws.kms.KMS.id, smithy4s.ShapeId("com.dwolla.config.smithy_shaded.com.amazonaws.kms", "TrentService"))"""), | ||
"""error: value KMS in package kms cannot be accessed as a member of object com.dwolla.config.smithy_shaded.com.amazonaws.kms.package from class ShadedGeneratedSmithySpec in package bincompat | ||
|assertEquals(com.dwolla.config.smithy_shaded.com.amazonaws.kms.KMS.id, smithy4s.ShapeId("com.dwolla.config.smithy_shaded.com.amazonaws.kms", "TrentService")) | ||
| ^ | ||
|""".stripMargin) | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
src/test/scala-3/bincompat/ShadedGeneratedSmithySpec.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package bincompat | ||
|
||
import munit.* | ||
|
||
class ShadedGeneratedSmithySpec extends FunSuite { | ||
test("we don't have access to the generated KMS objects in their original package") { | ||
assertNoDiff(compileErrors("""com.amazonaws.kms.KMS.id == smithy4s.ShapeId("com.amazonaws.kms", "TrentService")"""), | ||
"""error: | ||
|value amazonaws is not a member of com, but could be made available as an extension method. | ||
| | ||
|The following import might make progress towards fixing the problem: | ||
| | ||
| import munit.Clue.generate | ||
| | ||
|com.amazonaws.kms.KMS.id == smithy4s.ShapeId("com.amazonaws.kms", "TrentService") | ||
| ^ | ||
|""".stripMargin) | ||
} | ||
|
||
test("we don't have access to the generated KMS objects in the shaded package") { | ||
assertNoDiff(compileErrors("""assertEquals(com.dwolla.config.smithy_shaded.com.amazonaws.kms.KMS.id, smithy4s.ShapeId("com.dwolla.config.smithy_shaded.com.amazonaws.kms", "TrentService"))"""), | ||
"""error: | ||
|value KMS in package com.dwolla.config.smithy_shaded.com².amazonaws.kms cannot be accessed as a member of com.dwolla.config.smithy_shaded.com².amazonaws.kms.type from class ShadedGeneratedSmithySpec. | ||
| | ||
|where: com is a package | ||
| com² is a package in package com.dwolla.config.smithy_shaded | ||
|assertEquals(com.dwolla.config.smithy_shaded.com.amazonaws.kms.KMS.id, smithy4s.ShapeId("com.dwolla.config.smithy_shaded.com.amazonaws.kms", "TrentService")) | ||
| ^ | ||
|""".stripMargin) | ||
} | ||
} |