mirror of
https://github.com/akvorado/akvorado.git
synced 2025-12-11 22:14:02 +01:00
``` git ls-files \*.js \*.go \ | xargs sed -i '1i // SPDX-FileCopyrightText: 2022 Free Mobile\n// SPDX-License-Identifier: AGPL-3.0-only\n' git ls-files \*.vue \ | xargs sed -i '1i <!-- SPDX-FileCopyrightText: 2022 Free Mobile -->\n<!-- SPDX-License-Identifier: AGPL-3.0-only -->\n' ```
37 lines
700 B
Go
37 lines
700 B
Go
// SPDX-FileCopyrightText: 2022 Free Mobile
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
package cmd_test
|
|
|
|
import (
|
|
"bytes"
|
|
"fmt"
|
|
"runtime"
|
|
"strings"
|
|
"testing"
|
|
|
|
"akvorado/cmd"
|
|
"akvorado/common/helpers"
|
|
)
|
|
|
|
func TestVersion(t *testing.T) {
|
|
root := cmd.RootCmd
|
|
buf := new(bytes.Buffer)
|
|
root.SetOut(buf)
|
|
root.SetArgs([]string{"version"})
|
|
err := root.Execute()
|
|
if err != nil {
|
|
t.Errorf("`version` error:\n%+v", err)
|
|
}
|
|
want := []string{
|
|
"akvorado dev",
|
|
" Build date: unknown",
|
|
fmt.Sprintf(" Built with: %s", runtime.Version()),
|
|
"",
|
|
}
|
|
got := strings.Split(buf.String(), "\n")
|
|
if diff := helpers.Diff(got, want); diff != "" {
|
|
t.Errorf("`version` (-got, +want):\n%s", diff)
|
|
}
|
|
}
|