cutego/internal/utils/flags_test.go
Ángel 20f1341fb4
Fixed issues pointed on pull request
- Added missing target condition on "internal/cmd/deploy/build.go"
- Refactored flag append command on "internal/utils/flags.go" and
  added tests to verify function behaviour

Changes tested on Go 1.14.7 and Qt 5.13.2 and Qt 5.15.0

Signed-off-by: Ángel <angelo.fly1@gmail.com>
2020-09-01 23:24:43 +02:00

22 lines
627 B
Go

package utils
import (
"testing"
"github.com/stretchr/testify/require"
)
func TestAppendToFlag(t *testing.T) {
flags := []string{"-p", "-pkgdir=/usr/lib/testdir", "-mod", "-modfile go.mod"}
flags = AppendToFlag(flags, "-extldflags", "-v")
require.Equal(t, "-extldflags=-v", flags[4], "Flag was not inserted")
flags = AppendToFlag(flags, "-extldflags", "-Wl,soname,libname.so")
require.Equal(t, "-extldflags=-v -Wl,soname,libname.so", flags[4], "Flag was not appended with new content")
flags = AppendToFlag(flags, "-p", "test")
require.Equal(t, "-p=test", flags[0], "Content was not appended to simple flag")
}