File: path_test.go

package info (click to toggle)
gdu 5.34.2-1
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 1,288 kB
  • sloc: makefile: 145
file content (15 lines) | stat: -rw-r--r-- 485 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
package path

import (
	"testing"

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

func TestShortenPath(t *testing.T) {
	assert.Equal(t, "/root", ShortenPath("/root", 10))
	assert.Equal(t, "/home/.../foo", ShortenPath("/home/dundee/foo", 10))
	assert.Equal(t, "/home/dundee/foo", ShortenPath("/home/dundee/foo", 50))
	assert.Equal(t, "/home/dundee/.../bar.txt", ShortenPath("/home/dundee/foo/bar.txt", 20))
	assert.Equal(t, "/home/.../bar.txt", ShortenPath("/home/dundee/foo/bar.txt", 15))
}