File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change 1+ package updater
2+
3+ import (
4+ "os"
5+ "testing"
6+
7+ "github.com/arduino/go-paths-helper"
8+ "github.com/stretchr/testify/require"
9+ )
10+
11+ func TestTempDir (t * testing.T ) {
12+ userCacheDir , err := os .UserCacheDir ()
13+ require .NoError (t , err )
14+
15+ defaultTempDir , err := SetTempDir ("download-" , "" )
16+ defer defaultTempDir .RemoveAll ()
17+ require .NoError (t , err )
18+ require .DirExists (t , defaultTempDir .String ())
19+ require .Contains (t , defaultTempDir .Base (), "download-" )
20+ require .Contains (t , defaultTempDir .String (), userCacheDir )
21+
22+ customTempDir , err := SetTempDir ("extract-" , "." )
23+ defer customTempDir .RemoveAll ()
24+ require .NoError (t , err )
25+ require .DirExists (t , customTempDir .String ())
26+ require .Contains (t , customTempDir .Base (), "extract-" )
27+ require .Contains (t , customTempDir .String (), paths .New ("." ).String ())
28+ }
You can’t perform that action at this time.
0 commit comments