]> ruderich.org/simon Gitweb - nsscash/nsscash.git/commitdiff
nsscash: go fmt and rewrap comments
authorSimon Ruderich <simon@ruderich.org>
Thu, 1 Aug 2019 21:08:05 +0000 (23:08 +0200)
committerSimon Ruderich <simon@ruderich.org>
Thu, 1 Aug 2019 21:08:05 +0000 (23:08 +0200)
main_test.go

index ab5e9b7111399a5d999d1b794712d8e05a31e4c0..2b48bcc7c9d37315910f8efdac80633ed269a6af 100644 (file)
@@ -221,38 +221,37 @@ func runMainTest(t *testing.T, f func(args)) {
                groupPath,
        }
 
-               // NOTE: This is not guaranteed to work according to reflect's
-               // documentation but seems to work reliable for normal
-               // functions.
-               fn := runtime.FuncForPC(reflect.ValueOf(f).Pointer())
-               name := fn.Name()
-               name = name[strings.LastIndex(name, ".")+1:]
-
-               t.Run(name, func(t *testing.T) {
-                       // Preparation & cleanup
-                       for _, p := range cleanup {
-                               err := os.Remove(p)
-                               if err != nil && !os.IsNotExist(err) {
-                                       t.Fatal(err)
-                               }
-                               // Remove the file at the end of this test
-                               // run, if it was created
-                               defer os.Remove(p)
+       // NOTE: This is not guaranteed to work according to reflect's
+       // documentation but seems to work reliable for normal functions.
+       fn := runtime.FuncForPC(reflect.ValueOf(f).Pointer())
+       name := fn.Name()
+       name = name[strings.LastIndex(name, ".")+1:]
+
+       t.Run(name, func(t *testing.T) {
+               // Preparation & cleanup
+               for _, p := range cleanup {
+                       err := os.Remove(p)
+                       if err != nil && !os.IsNotExist(err) {
+                               t.Fatal(err)
                        }
+                       // Remove the file at the end of this test run, if it
+                       // was created
+                       defer os.Remove(p)
+               }
 
-                       var handler func(http.ResponseWriter, *http.Request)
-                       ts := httptest.NewServer(http.HandlerFunc(
-                               func(w http.ResponseWriter, r *http.Request) {
-                                       handler(w, r)
-                               }))
-                       defer ts.Close()
-
-                       f(args{
-                               t:       t,
-                               url:     ts.URL,
-                               handler: &handler,
-                       })
+               var handler func(http.ResponseWriter, *http.Request)
+               ts := httptest.NewServer(http.HandlerFunc(
+                       func(w http.ResponseWriter, r *http.Request) {
+                               handler(w, r)
+                       }))
+               defer ts.Close()
+
+               f(args{
+                       t:       t,
+                       url:     ts.URL,
+                       handler: &handler,
                })
+       })
 }
 
 func fetchPasswdCacheFileDoesNotExist(a args) {