@@ -2,6 +2,7 @@ package zio.schema
22
33import scala .collection .immutable .ListMap
44
5+ import zio .Chunk
56import zio .schema .CaseSet ._
67import zio .test .Assertion ._
78import zio .test .{ ZSpec , _ }
@@ -17,26 +18,33 @@ object SchemaSpec extends DefaultRunnableSpec {
1718 assert(Schema .chunk(schemaUnit))(equalTo(Schema .chunk(schemaUnit)))
1819 },
1920 test(" tuple" ) {
20- assert(Schema .Tuple (schemaUnit, schemaUnit))(equalTo(Schema .Tuple (schemaUnit, schemaUnit)))
21+ assert(Schema .Tuple (schemaUnit, schemaUnit))(equalTo(Schema .Tuple (schemaUnit, schemaUnit))) &&
2122 assert(Schema .Tuple (schemaTransform, schemaTransform))(equalTo(Schema .Tuple (schemaTransform, schemaTransform)))
2223 },
2324 test(" record" ) {
24- assert(schemaRecord(" key" ))(equalTo(schemaRecord(" key" )))
25+ assert(schemaRecord(" key" ))(equalTo(schemaRecord(" key" ))) &&
2526 assert(schemaRecord(" key1" ))(not(equalTo(schemaRecord(" key2" ))))
2627 },
2728 test(" transform" ) {
28- assert(schemaTransform)(equalTo(schemaTransform))
29+ assert(schemaTransform)(equalTo(schemaTransform)) &&
2930 assert(schemaTransformMethod)(equalTo(schemaTransformMethod))
3031 },
3132 test(" optional" ) {
3233 assert(Schema .Optional (schemaUnit))(equalTo(Schema .Optional (schemaUnit)))
3334 },
3435 test(" enumeration" ) {
35- assert(schemaEnum(" key" ))(equalTo(schemaEnum(" key" )))
36+ assert(schemaEnum(" key" ))(equalTo(schemaEnum(" key" ))) &&
3637 assert(schemaEnum(" key1" ))(not(equalTo(schemaEnum(" key2" ))))
3738
3839 }
39- )
40+ ),
41+ test(" Tuple.toRecord should preserve annotations" ) {
42+ val left = Schema .primitive(StandardType .StringType )
43+ val right = Schema .primitive(StandardType .StringType )
44+ val tupleSchema = Schema .Tuple (left, right, Chunk (" some Annotation" ))
45+ val record = tupleSchema.toRecord
46+ assert(record.annotations)(hasFirst(equalTo(" some Annotation" )))
47+ }
4048 )
4149
4250 def schemaUnit : Schema [Unit ] = Schema [Unit ]
0 commit comments