Skip to content

Commit

Permalink
Go: override methods which generates error checks instead of hacking …
Browse files Browse the repository at this point in the history
…output
  • Loading branch information
Mingun committed Apr 13, 2024
1 parent 464c8cd commit 5422af5
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,14 @@ class GoSG(spec: TestSpec, provider: ClassTypeProvider) extends BaseGenerator(sp
*/
class GoTestOutputWriter(indentStr: String) extends GoOutputWriter(indentStr) {
override def puts(s: String): Unit = {
val mangled = s.replace(REPLACER, "r.").replaceAll("return err$", "t.Fatal(err)")
super.puts(mangled)
super.puts(s.replace(REPLACER, "r."))
}
override def putsErrCheck(result: Option[String]): Unit = {
puts("if err != nil {")
inc
puts("t.Fatal(err)")
dec
puts("}")
}
}

Expand Down

0 comments on commit 5422af5

Please sign in to comment.