mirror of
https://github.com/neilotoole/sq.git
synced 2024-12-21 07:01:41 +03:00
97739da1e1
* sq version host info * workflow: update bug_report.md with version instructions
29 lines
501 B
Go
29 lines
501 B
Go
package cli_test
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/neilotoole/sq/cli"
|
|
"github.com/neilotoole/sq/testh/tutil"
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func TestLastHandlePart(t *testing.T) {
|
|
testCases := []struct {
|
|
in string
|
|
want string
|
|
}{
|
|
{"@handle", "handle"},
|
|
{"@prod/db", "db"},
|
|
{"@prod/sub/db", "db"},
|
|
}
|
|
|
|
for i, tc := range testCases {
|
|
tc := tc
|
|
t.Run(tutil.Name(i, tc.in), func(t *testing.T) {
|
|
got := cli.LastHandlePart(tc.in)
|
|
require.Equal(t, tc.want, got)
|
|
})
|
|
}
|
|
}
|