2017-04-15 15:41:41 -03:00
|
|
|
package fpm
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/goreleaser/goreleaser/config"
|
|
|
|
"github.com/goreleaser/goreleaser/context"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestDescription(t *testing.T) {
|
2017-12-02 19:53:19 -02:00
|
|
|
assert.NotEmpty(t, Pipe{}.String())
|
2017-04-15 15:41:41 -03:00
|
|
|
}
|
|
|
|
|
2017-12-03 12:12:02 -02:00
|
|
|
func TestDefault(t *testing.T) {
|
|
|
|
var ctx = &context.Context{
|
|
|
|
Config: config.Project{
|
2018-02-26 18:49:58 -03:00
|
|
|
FPM: config.NFPM{
|
|
|
|
Formats: []string{"deb"},
|
|
|
|
},
|
2017-12-03 12:12:02 -02:00
|
|
|
},
|
|
|
|
}
|
|
|
|
assert.NoError(t, Pipe{}.Default(ctx))
|
2018-02-26 18:49:58 -03:00
|
|
|
assert.Equal(t, ctx.Config.FPM, ctx.Config.NFPM)
|
2017-12-03 12:12:02 -02:00
|
|
|
}
|
|
|
|
|
|
|
|
func TestDefaultSet(t *testing.T) {
|
|
|
|
var ctx = &context.Context{
|
|
|
|
Config: config.Project{
|
2018-02-26 18:49:58 -03:00
|
|
|
NFPM: config.NFPM{
|
|
|
|
Formats: []string{"deb"},
|
2017-12-03 12:12:02 -02:00
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
assert.NoError(t, Pipe{}.Default(ctx))
|
2018-02-26 18:49:58 -03:00
|
|
|
assert.Equal(t, config.NFPM{}, ctx.Config.FPM)
|
2017-12-03 12:12:02 -02:00
|
|
|
}
|