๐Ÿ“ฆ jtr109 / go-playground

๐Ÿ“„ lib_test.go ยท 20 lines
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20package reversewordsinastring

import (
	"testing"

	"github.com/stretchr/testify/assert"
)

func TestExample1(t *testing.T) {
	s := "the sky is blue"
	expected := "blue is sky the"
	assert.Equal(t, expected, reverseWords(s))
}

func TestExample2(t *testing.T) {
	s := "  hello world  "
	expected := "world hello"
	assert.Equal(t, expected, reverseWords(s))
}