๐Ÿ“ฆ jtr109 / go-playground

๐Ÿ“„ lib_test.go ยท 29 lines
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29package simplifypath

import (
	"testing"

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

func TestExample1(t *testing.T) {
	input := "/home/"
	expected := "/home"
	actual := simplifyPath(input)
	assert.Equal(t, expected, actual)
}

func TestExample2(t *testing.T) {
	input := "/../"
	expected := "/"
	actual := simplifyPath(input)
	assert.Equal(t, expected, actual)
}

func TestExample3(t *testing.T) {
	input := "/home//foo/"
	expected := "/home/foo"
	actual := simplifyPath(input)
	assert.Equal(t, expected, actual)
}