@@ -275,16 +275,16 @@ func staticInclusionProbes(rootDir string) error {
275275}
276276
277277func writeInclusionProbe (dir string , probe inclusionProbe ) error {
278- fileName := strings . ReplaceAll (probe .Desc , " " , "-" ) + ".json"
278+ fn := fileName (probe .Desc )
279279
280280 probeJson , err := json .MarshalIndent (probe , "" , " " )
281281 if err != nil {
282282 return fmt .Errorf ("marshaling probe: %s" , err )
283283 }
284284
285- fileLocation := filepath .Join (dir , fileName )
285+ fileLocation := filepath .Join (dir , fn )
286286 if err := os .WriteFile (fileLocation , probeJson , 0644 ); err != nil {
287- return fmt .Errorf ("writing probe: %s: %s" , fileName , err )
287+ return fmt .Errorf ("writing probe: %s: %s" , fn , err )
288288 }
289289
290290 return nil
@@ -403,9 +403,9 @@ func staticConsistencyProbes(dir string) error {
403403 {0 , 0 , root1 , root2 , proof1 , "sizes are equal (zero) but roots are not" , true },
404404 {1 , 1 , root1 , root2 , proof1 , "sizes are equal (one) but roots are not" , true },
405405 // Sizes that are always consistent.
406- {0 , 0 , root1 , root1 , proof1 , "sizes are equal and proof is not empty where both sizes are zero " , false },
406+ {0 , 0 , root1 , root1 , proof1 , "sizes are equal (zero) and proof is empty" , false },
407407 {0 , 1 , root1 , root2 , proof1 , "size1 is zero and does not equal size2" , true },
408- {1 , 1 , root2 , root2 , proof1 , "sizes are equal and proof is not empty where both sizes are one " , false },
408+ {1 , 1 , root2 , root2 , proof1 , "sizes are equal (one) and proof is empty" , false },
409409 // Time travel to the past.
410410 {1 , 0 , root1 , root2 , proof1 , "size1 is greater than size2" , true },
411411 {2 , 1 , root1 , root2 , proof1 , "size1 is greater than size2 again" , true },
@@ -431,16 +431,16 @@ func staticConsistencyProbes(dir string) error {
431431}
432432
433433func writeConsistencyProbe (dir string , probe consistencyProbe ) error {
434- fileName := strings . ReplaceAll (probe .Desc , " " , "-" ) + ".json"
434+ fn := fileName (probe .Desc )
435435
436436 probeJson , err := json .MarshalIndent (probe , "" , " " )
437437 if err != nil {
438438 return fmt .Errorf ("marshaling probe: %s" , err )
439439 }
440440
441- fileLocation := filepath .Join (dir , fileName )
441+ fileLocation := filepath .Join (dir , fn )
442442 if err := os .WriteFile (fileLocation , probeJson , 0644 ); err != nil {
443- return fmt .Errorf ("writing probe: %s: %s" , fileName , err )
443+ return fmt .Errorf ("writing probe: %s: %s" , fn , err )
444444 }
445445
446446 return nil
@@ -467,6 +467,14 @@ func dh(h string, expLen int) []byte {
467467 return r
468468}
469469
470+ func fileName (n string ) string {
471+ r := strings .NewReplacer (
472+ "(" , "" ,
473+ ")" , "" ,
474+ " " , "-" )
475+ return r .Replace (n ) + ".json"
476+ }
477+
470478func main () {
471479 inclusionDir := "testdata/inclusion"
472480 if err := inclusionProbes (inclusionDir ); err != nil {
0 commit comments