Skip to content

Commit

Permalink
✅ [tests] init tests for cmd_utils
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasnevespereira committed Sep 22, 2021
1 parent 8ca9aac commit 1339220
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions tests/utils_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package tests

import (
"fmt"
"reflect"
"strconv"
"testing"

"github.com/noculture/notes/utils"
)

var testArgs = []string{"1", "2", "3"}

func TestParseUInt64Slice(t *testing.T) {
var expected []uint64

for _, arg := range testArgs {
intArg, err := strconv.ParseInt(arg, 10, 64)
if err != nil {
fmt.Println(err)
}
expected = append(expected, uint64(intArg))
}

got, err := utils.ParseUInt64Slice(testArgs)
if err != nil {
t.Errorf("err got %v, want nil", err)
}

if !reflect.DeepEqual(got, expected) {
t.Errorf("got %v, expected %v \n", got, expected)
}

}

0 comments on commit 1339220

Please sign in to comment.