diff2markdown_test.go
TLDR
This file contains a test function for reversing a slice of strings. It uses the github.com/stretchr/testify/assert
package for assertions.
Methods
Test_reverse
This method is a test function for reversing a slice of strings. It takes in a testing.T object, runs various test cases, and asserts that the reversed slice matches the expected output.
Classes
None
package notifysubscriptions
import (
"testing"
"github.com/stretchr/testify/assert"
)
func Test_reverse(t *testing.T) {
tests := []struct {
name string
ss []string
want []string
}{
{name: "even", ss: []string{"one", "two", "three", "four"}, want: []string{"four", "three", "two", "one"}},
{name: "odd", ss: []string{"one", "two", "three"}, want: []string{"three", "two", "one"}},
{name: "one", ss: []string{"one"}, want: []string{"one"}},
{name: "empty", ss: []string{}, want: []string{}},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
reverse(tt.ss)
assert.Equal(t, tt.want, tt.ss)
})
}
}