1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-01-08 03:31:59 +02:00
goreleaser/pipeline/brew/brew_test.go
Carlos Alexandro Becker a969e493a4
fixes
2016-12-30 09:53:05 -02:00

53 lines
1.2 KiB
Go

package brew
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestNameWithDash(t *testing.T) {
assert.Equal(t, formulaNameFor("some-binary"), "SomeBinary")
}
func TestNameWithUnderline(t *testing.T) {
assert.Equal(t, formulaNameFor("some_binary"), "SomeBinary")
}
func TestSimpleName(t *testing.T) {
assert.Equal(t, formulaNameFor("binary"), "Binary")
}
var testFormulaeExpected = `class Test < Formula
desc "Some desc"
homepage "https://google.com"
url "https://github.com/caarlos0/test/releases/download/v0.1.3/test_#{%x(uname -s).gsub(/\n/, '')}_#{%x(uname -m).gsub(/\n/, '')}.tar.gz"
head "https://github.com/caarlos0/test.git"
version "v0.1.3"
def install
bin.install "test"
end
def caveats
"Here are some caveats"
end
end
`
func TestFormulae(t *testing.T) {
assert := assert.New(t)
out, err := doBuildFormulae(templateData{
BinaryName: "test",
Desc: "Some desc",
Homepage: "https://google.com",
Name: "Test",
Repo: "caarlos0/test",
Tag: "v0.1.3",
Caveats: "Here are some caveats",
})
assert.NoError(err)
assert.NoError(err)
assert.Equal(testFormulaeExpected, out.String())
}