@@ -79,7 +79,7 @@ func TestWithTemplate(t *testing.T) {
7979 {"id": "1.2.3.4", "value": {{ asn1Enc (first .Insecure.CR.DNSNames) | toJson }}},
8080 {"id": "1.2.3.5", "value": {{ asn1Marshal (first .Insecure.CR.DNSNames) | toJson }}},
8181 {"id": "1.2.3.6", "value": {{ asn1Seq (asn1Enc (first .Insecure.CR.DNSNames)) (asn1Enc "int:123456") | toJson }}},
82- {"id": "1.2.3.7", "value": {{ asn1Set (asn1Marshal (first .Insecure.CR.DNSNames) "utf8") (asn1Enc "int:123456 ") | toJson }}}
82+ {"id": "1.2.3.7", "value": {{ asn1Set (asn1Marshal (first .Insecure.CR.DNSNames) "utf8") (asn1Enc "bool:true ") | toJson }}}
8383 ]
8484}`
8585
@@ -181,7 +181,7 @@ func TestWithTemplate(t *testing.T) {
181181 {"id": "1.2.3.4", "value": "Ewdmb28uY29t"},
182182 {"id": "1.2.3.5", "value": "Ewdmb28uY29t"},
183183 {"id": "1.2.3.6", "value": "MA4TB2Zvby5jb20CAwHiQA=="},
184- {"id": "1.2.3.7", "value": "MQ4MB2Zvby5jb20CAwHiQA= ="}
184+ {"id": "1.2.3.7", "value": "MQwMB2Zvby5jb20BAf8 ="}
185185 ]
186186}` ),
187187 }, false },
@@ -340,9 +340,11 @@ func Test_asn1Encode(t *testing.T) {
340340 {"ok generalized" , args {"generalized:" + now .Format (time .RFC3339 )}, mustMarshal (t , now , "generalized" ), false },
341341 {"ok int" , args {"int:1234" }, mustMarshal (t , 1234 , "" ), false },
342342 {"ok numeric" , args {"numeric:1234" }, mustMarshal (t , "1234" , "numeric" ), false },
343+ {"ok bool" , args {"bool:true" }, mustMarshal (t , true , "" ), false },
343344 {"ok raw" , args {"raw:" + mustMarshal (t , 1234 , "" )}, mustMarshal (t , 1234 , "" ), false },
344345 {"fail numeric" , args {"numeric:not-a-number" }, "" , true },
345346 {"fail time" , args {"utc:not-a-time" }, "" , true },
347+ {"fail bool" , args {"bool:untrue" }, "" , true },
346348 }
347349 for _ , tt := range tests {
348350 t .Run (tt .name , func (t * testing.T ) {
@@ -375,6 +377,7 @@ func Test_asn1Marshal(t *testing.T) {
375377 {"ok time" , args {now , nil }, mustMarshal (t , now , "utc" ), false },
376378 {"ok seq" , args {[]any {"string" , 1234 }, nil }, mustMarshal (t , []any {"string" , 1234 }, "" ), false },
377379 {"ok set" , args {[]any {"string" , 1234 }, []string {"set" }}, mustMarshal (t , []any {"string" , 1234 }, "set" ), false },
380+ {"ok bool" , args {false , nil }, mustMarshal (t , false , "" ), false },
378381 {"fail numeric" , args {"string" , []string {"numeric" }}, "" , true },
379382 }
380383 for _ , tt := range tests {
0 commit comments