You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@plc4x.apache.org by sr...@apache.org on 2021/03/18 18:35:02 UTC

[plc4x] branch develop updated: plc4go: Improve error output on test failure + Provide a diff view for cases when the test fails

This is an automated email from the ASF dual-hosted git repository.

sruehl pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/plc4x.git


The following commit(s) were added to refs/heads/develop by this push:
     new 85efa27  plc4go: Improve error output on test failure + Provide a diff view for cases when the test fails
85efa27 is described below

commit 85efa2738e38ed9a64486ccf8c8442c35cc52f65
Author: Sebastian Rühl <sr...@apache.org>
AuthorDate: Thu Mar 18 19:34:43 2021 +0100

    plc4go: Improve error output on test failure
    + Provide a diff view for cases when the test fails
---
 plc4go/internal/plc4go/spi/testutils/DriverTestRunner.go | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/plc4go/internal/plc4go/spi/testutils/DriverTestRunner.go b/plc4go/internal/plc4go/spi/testutils/DriverTestRunner.go
index 061f551..c88ee69 100644
--- a/plc4go/internal/plc4go/spi/testutils/DriverTestRunner.go
+++ b/plc4go/internal/plc4go/spi/testutils/DriverTestRunner.go
@@ -225,8 +225,7 @@ func (m DriverTestsuite) ExecuteStep(connection plc4go.PlcConnection, testcase *
 		// Compare the bytes read with the ones we expect
 		for i := range expectedRawOutput {
 			if expectedRawOutput[i] != rawOutput[i] {
-				// TODO: render diff
-				return errors.New("actual output doesn't match expected output")
+				return errors.Errorf("actual output doesn't match expected output:\nactual:   0x%X\nexpected: 0x%X", rawOutput, expectedRawOutput)
 			}
 		}
 		// If there's a difference, parse the input and display it to simplify debugging
@@ -243,9 +242,8 @@ func (m DriverTestsuite) ExecuteStep(connection plc4go.PlcConnection, testcase *
 
 		// Compare the bytes read with the ones we expect
 		for i := range expectedRawInput {
-			// TODO: render diff
 			if expectedRawInput[i] != rawInput[i] {
-				return errors.New("actual output doesn't match expected output")
+				return errors.Errorf("actual output doesn't match expected output:\nactual:   0x%X\nexpected: 0x%X", rawInput, expectedRawInput)
 			}
 		}
 		// If there's a difference, parse the input and display it to simplify debugging