File: trash_test.go

package info (click to toggle)
golang-github-rkoesters-xdg 0.0~git20181125.edd15b8-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 220 kB
  • sloc: makefile: 5
file content (37 lines) | stat: -rw-r--r-- 657 bytes parent folder | download
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
29
30
31
32
33
34
35
36
37
package trash

import (
	"testing"
)

func TestListFiles(t *testing.T) {
	files, err := Files()
	if err != nil {
		t.Error(err)
	}
	for _, i := range files {
		t.Log(i)
	}
}

func TestStat(t *testing.T) {
	files, err := Files()
	if err != nil {
		t.Error(err)
	}
	for _, i := range files {
		info, err := Stat(i)
		if err != nil {
			t.Error(err)
		}
		t.Log(info)
	}
}

func TestIsEmpty(t *testing.T) {
	// We can't expect a value for IsEmpty because it depends on the
	// contents of the user's trash which could be empty or not. So
	// we just call the function to make sure it doesn't panic or
	// anything extreme.
	t.Logf("IsEmpty()=%v", IsEmpty())
}