Explorar el Código

chore: make print pretty (#1967)

Kevin Wan hace 2 años
padre
commit
f366e1d936
Se han modificado 2 ficheros con 7 adiciones y 5 borrados
  1. 2 1
      rest/engine.go
  2. 5 4
      rest/server_test.go

+ 2 - 1
rest/engine.go

@@ -196,8 +196,9 @@ func (ng *engine) print() {
 
 	sort.Strings(routes)
 
+	fmt.Println("routes:")
 	for _, route := range routes {
-		fmt.Println(route)
+		fmt.Printf("  %s\n", route)
 	}
 }
 

+ 5 - 4
rest/server_test.go

@@ -350,10 +350,11 @@ func TestServer_PrintRoutes(t *testing.T) {
 Name: foo
 Port: 54321
 `
-		expect = `GET /bar
-GET /foo
-GET /foo/:bar
-GET /foo/:bar/baz
+		expect = `routes:
+  GET /bar
+  GET /foo
+  GET /foo/:bar
+  GET /foo/:bar/baz
 `
 	)