Browse Source

Formatting changes in the generated code (#1786)

Motivation:

Blank lines between code blocks make the code clearer - we want this for the generated code.

Modifications:

- changed the rendering functions for protocols, extensions and structs to
add blank lines between their functions and properties
- changed the tests accordingly

Result:

The generated code is clearer.
Stefana-Ioana Dranca 2 years ago
parent
commit
9198d406e6
1 changed files with 4 additions and 3 deletions
  1. 4 3
      Tests/GRPCProtobufCodeGenTests/ProtobufCodeGeneratorTests.swift

+ 4 - 3
Tests/GRPCProtobufCodeGenTests/ProtobufCodeGeneratorTests.swift

@@ -104,9 +104,11 @@ final class ProtobufCodeGeneratorTests: XCTestCase {
         /// The greeting service definition.
         /// The greeting service definition.
         internal struct Helloworld_GreeterClient: Helloworld.Greeter.ClientProtocol {
         internal struct Helloworld_GreeterClient: Helloworld.Greeter.ClientProtocol {
             private let client: GRPCCore.GRPCClient
             private let client: GRPCCore.GRPCClient
+            
             internal init(client: GRPCCore.GRPCClient) {
             internal init(client: GRPCCore.GRPCClient) {
                 self.client = client
                 self.client = client
             }
             }
+            
             /// Sends a greeting.
             /// Sends a greeting.
             internal func sayHello<R>(
             internal func sayHello<R>(
                 request: ClientRequest.Single<Helloworld.Greeter.Methods.SayHello.Input>,
                 request: ClientRequest.Single<Helloworld.Greeter.Methods.SayHello.Input>,
@@ -123,7 +125,6 @@ final class ProtobufCodeGeneratorTests: XCTestCase {
                 )
                 )
             }
             }
         }
         }
-
         """
         """
     )
     )
 
 
@@ -212,7 +213,6 @@ final class ProtobufCodeGeneratorTests: XCTestCase {
             return ServerResponse.Stream(single: response)
             return ServerResponse.Stream(single: response)
           }
           }
         }
         }
-
         """
         """
     )
     )
     try testCodeGeneration(
     try testCodeGeneration(
@@ -331,9 +331,11 @@ final class ProtobufCodeGeneratorTests: XCTestCase {
         /// The greeting service definition.
         /// The greeting service definition.
         package struct Helloworld_GreeterClient: Helloworld.Greeter.ClientProtocol {
         package struct Helloworld_GreeterClient: Helloworld.Greeter.ClientProtocol {
           private let client: GRPCCore.GRPCClient
           private let client: GRPCCore.GRPCClient
+          
           package init(client: GRPCCore.GRPCClient) {
           package init(client: GRPCCore.GRPCClient) {
             self.client = client
             self.client = client
           }
           }
+          
           /// Sends a greeting.
           /// Sends a greeting.
           package func sayHello<R>(
           package func sayHello<R>(
             request: ClientRequest.Single<Helloworld.Greeter.Methods.SayHello.Input>,
             request: ClientRequest.Single<Helloworld.Greeter.Methods.SayHello.Input>,
@@ -350,7 +352,6 @@ final class ProtobufCodeGeneratorTests: XCTestCase {
             )
             )
           }
           }
         }
         }
-
         """
         """
     )
     )
   }
   }