-
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.
Fix for issue #27 which slipped through our tests
- Loading branch information
1 parent
4fc6cbc
commit 590a0a2
Showing
2 changed files
with
72 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
package pipez | ||
|
||
class BugReportSpec extends munit.FunSuite { | ||
|
||
test("Bug report https://github.com/MateuszKubuszok/pipez/issues/27") { | ||
// Bug was related to weird behavior in Scala 3 macros where symbols for case class fields are doubled: | ||
// - there is one "val fieldName" | ||
// - and there is one "method fieldName " (with space at the end!) | ||
// This behavior was breaking matching by position (where input/output is a Tuple) but the workaround used | ||
// unreliable solution which sometimes filtered out _all_ case class fields. | ||
case class OvpnConfigurationFile( | ||
id: String, | ||
createdAt: Long, | ||
name: String, | ||
notBefore: String, | ||
notAfter: String, | ||
contents: String | ||
) | ||
|
||
case class OvpnConfigurationFileResponse( | ||
id: String, | ||
createdAt: Long, | ||
name: String, | ||
notBefore: String, | ||
notAfter: String | ||
) | ||
assertEquals( | ||
ContextCodec | ||
.derive[OvpnConfigurationFile, OvpnConfigurationFileResponse] | ||
.decode( | ||
OvpnConfigurationFile( | ||
id = "foo", | ||
createdAt = 0, | ||
name = "bar", | ||
notBefore = "x", | ||
notAfter = "y", | ||
contents = "z" | ||
), | ||
false, | ||
"" | ||
), | ||
Right( | ||
OvpnConfigurationFileResponse( | ||
id = "foo", | ||
createdAt = 0, | ||
name = "bar", | ||
notBefore = "x", | ||
notAfter = "y" | ||
) | ||
) | ||
) | ||
} | ||
} |