Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1241)

Unified Diff: go/src/infra/libs/infra_util/test_utils.go

Issue 662113003: Drover's back, baby! (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git/+/master
Patch Set: more tests and refactors Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « go/src/infra/libs/infra_util/stringSet.go ('k') | go/src/infra/tools/drover/default_shell_darwin.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: go/src/infra/libs/infra_util/test_utils.go
diff --git a/go/src/infra/libs/infra_util/test_utils.go b/go/src/infra/libs/infra_util/test_utils.go
new file mode 100644
index 0000000000000000000000000000000000000000..2e1aa266d5812944fd1a4ea26ce58b2fd84c765d
--- /dev/null
+++ b/go/src/infra/libs/infra_util/test_utils.go
@@ -0,0 +1,25 @@
+package infra_util
+
+import (
+ "io/ioutil"
+ "os"
+)
+
+func WithTempDir(dir, name string, f func(tmpdir string)) {
+ var pval interface{}
+ d, err := ioutil.TempDir(dir, name)
+ if err != nil {
+ panic(err)
+ }
+ func() {
+ defer func() { pval = recover() }()
+ f(d)
+ }()
+ err = os.RemoveAll(d)
+ if err != nil {
+ panic(err)
+ }
+ if pval != nil {
+ panic(pval)
+ }
+}
« no previous file with comments | « go/src/infra/libs/infra_util/stringSet.go ('k') | go/src/infra/tools/drover/default_shell_darwin.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698