jackett 0.22.1382
[Homebrew/homebrew-core.git] / Formula / r / richgo.rb
blobb95df6585e36d61bbbd0d7b7b7a6a481c9c3cbf0
1 class Richgo < Formula
2   desc "Enrich `go test` outputs with text decorations"
3   homepage "https://github.com/kyoh86/richgo"
4   url "https://github.com/kyoh86/richgo/archive/refs/tags/v0.3.12.tar.gz"
5   sha256 "811db92c36818be053fa3950d40f8cca13912b8a4a9f54b82a63e2f112d2c4fe"
6   license "MIT"
7   head "https://github.com/kyoh86/richgo.git", branch: "main"
9   bottle do
10     rebuild 1
11     sha256 cellar: :any_skip_relocation, arm64_sequoia: "967353f6b2bfa1c35a96f76eb85b98d3e6ea91d8b424a2655e80ab957884591b"
12     sha256 cellar: :any_skip_relocation, arm64_sonoma:  "967353f6b2bfa1c35a96f76eb85b98d3e6ea91d8b424a2655e80ab957884591b"
13     sha256 cellar: :any_skip_relocation, arm64_ventura: "967353f6b2bfa1c35a96f76eb85b98d3e6ea91d8b424a2655e80ab957884591b"
14     sha256 cellar: :any_skip_relocation, sonoma:        "31d3f488ac0adb8874295408a1ea9c56acfbf9a90484d90b3e34d76ffcf20927"
15     sha256 cellar: :any_skip_relocation, ventura:       "31d3f488ac0adb8874295408a1ea9c56acfbf9a90484d90b3e34d76ffcf20927"
16     sha256 cellar: :any_skip_relocation, x86_64_linux:  "da63b93248cf2292a4c287cc5973c39eded1d3c349ebfba315b3913883045d3c"
17   end
19   depends_on "go" => [:build, :test]
21   def install
22     system "go", "build", *std_go_args(ldflags: "-s -w")
23   end
25   test do
26     (testpath/"go.mod").write <<~GOMOD
27       module github.com/Homebrew/brew-test
29       go 1.21
30     GOMOD
32     (testpath/"main.go").write <<~GO
33       package main
35       import "fmt"
37       func Hello() string {
38         return "Hello, gotestsum."
39       }
41       func main() {
42         fmt.Println(Hello())
43       }
44     GO
46     (testpath/"main_test.go").write <<~GO
47       package main
49       import "testing"
51       func TestHello(t *testing.T) {
52         got := Hello()
53         want := "Hello, gotestsum."
54         if got != want {
55           t.Errorf("got %q, want %q", got, want)
56         }
57       }
58     GO
60     output = shell_output("#{bin}/richgo test ./...")
62     expected = if OS.mac?
63       "PASS | github.com/Homebrew/brew-test"
64     else
65       "ok  \tgithub.com/Homebrew/brew-test"
66     end
67     assert_match expected, output
68   end
69 end