From c03c275b48d168faf2587d85bf04b97091a5b4d2 Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Thu, 26 Jul 2018 11:33:20 -0700 Subject: [PATCH] Add special_status_message interop test --- test/api/interop_sanity_test.js | 1 + test/interop/interop_client.js | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/test/api/interop_sanity_test.js b/test/api/interop_sanity_test.js index 0ff4c28b..27441e96 100644 --- a/test/api/interop_sanity_test.js +++ b/test/api/interop_sanity_test.js @@ -38,6 +38,7 @@ const testCases = [ 'timeout_on_sleeping_server', 'custom_metadata', 'status_code_and_message', + 'special_status_message', 'unimplemented_service', 'unimplemented_method' ]; diff --git a/test/interop/interop_client.js b/test/interop/interop_client.js index 195ef8d4..447b018a 100644 --- a/test/interop/interop_client.js +++ b/test/interop/interop_client.js @@ -369,6 +369,22 @@ function statusCodeAndMessage(client, done) { duplex.end(); } +function specialStatusMessage(client, done) { + let expectedMessage = '\t\ntest with whitespace\r\nand Unicode BMP ☺ and non-BMP 😈\t\n'; + let arg = { + response_status: { + code: 2, + message: expectedMessage + } + }; + client.unaryCall(arg, function(err, resp) { + assert(err); + assert.strictEqual(err.code, 2); + assert.strictEqual(err.details, expectedMessage); + done(); + }); +} + // NOTE: the client param to this function is from UnimplementedService function unimplementedService(client, done) { client.unimplementedCall({}, function(err, resp) { @@ -530,6 +546,8 @@ var test_cases = { Client: testProto.TestService}, status_code_and_message: {run: statusCodeAndMessage, Client: testProto.TestService}, + special_status_message: {run: specialStatusMessage, + Client: testProto.TestService}, unimplemented_service: {run: unimplementedService, Client: testProto.UnimplementedService}, unimplemented_method: {run: unimplementedMethod,