1- package core
1+ package core_test
22
33import (
44 "testing"
55
6+ "github.com/scaleway/scaleway-cli/v2/internal/core"
7+
68 "github.com/alecthomas/assert"
79 "github.com/scaleway/scaleway-cli/v2/internal/alias"
810)
911
1012func TestCommandMatchAlias (t * testing.T ) {
11- commandWithArg := & Command {
13+ commandWithArg := & core. Command {
1214 Namespace : "first" ,
1315 Resource : "command" ,
14- ArgSpecs : ArgSpecs {
16+ ArgSpecs : core. ArgSpecs {
1517 {
1618 Name : "arg" ,
1719 },
1820 },
1921 }
20- commandWithoutArg := & Command {
22+ commandWithoutArg := & core. Command {
2123 Namespace : "second" ,
2224 Resource : "command" ,
23- ArgSpecs : ArgSpecs {
25+ ArgSpecs : core. ArgSpecs {
2426 {
2527 Name : "other-arg" ,
2628 },
@@ -32,28 +34,28 @@ func TestCommandMatchAlias(t *testing.T) {
3234 Command : []string {"command" },
3335 }
3436
35- assert .True (t , commandWithArg .matchAlias (testAlias ))
36- assert .True (t , commandWithoutArg .matchAlias (testAlias ))
37+ assert .True (t , commandWithArg .MatchAlias (testAlias ))
38+ assert .True (t , commandWithoutArg .MatchAlias (testAlias ))
3739
3840 testAliasWithArg := alias.Alias {
3941 Name : "alias" ,
4042 Command : []string {"command" , "arg=value" },
4143 }
4244
43- assert .True (t , commandWithArg .matchAlias (testAliasWithArg ))
44- assert .False (t , commandWithoutArg .matchAlias (testAliasWithArg ))
45+ assert .True (t , commandWithArg .MatchAlias (testAliasWithArg ))
46+ assert .False (t , commandWithoutArg .MatchAlias (testAliasWithArg ))
4547}
4648
4749func TestAliasChildCommand (t * testing.T ) {
48- namespace := & Command {
50+ namespace := & core. Command {
4951 Namespace : "namespace" ,
5052 }
51- resource := & Command {
53+ resource := & core. Command {
5254 Namespace : "namespace" ,
5355 Resource : "first" ,
5456 }
5557
56- commands := NewCommands (
58+ commands := core . NewCommands (
5759 namespace ,
5860 resource ,
5961 )
@@ -63,12 +65,12 @@ func TestAliasChildCommand(t *testing.T) {
6365 Command : []string {"namespace" , "first" },
6466 }
6567
66- assert .True (t , commands .aliasIsValidCommandChild (namespace , validAlias ))
68+ assert .True (t , commands .AliasIsValidCommandChild (namespace , validAlias ))
6769
6870 invalidAlias := alias.Alias {
6971 Name : "alias" ,
7072 Command : []string {"namespace" , "random" },
7173 }
7274
73- assert .False (t , commands .aliasIsValidCommandChild (namespace , invalidAlias ))
75+ assert .False (t , commands .AliasIsValidCommandChild (namespace , invalidAlias ))
7476}
0 commit comments