test.compareTextFiles

Boolean test.compareTextFiles(expectedFilePath, actualFilePath)

Boolean test.compareTextFiles(expectedFilePath, actualFilePath, options)

This function compares the expected file specified by expectedFilePath and compares it to the actual file specified by actualFilePath. If they are equal a test result of type PASS is added to the test log and the function returns a true value. Otherwise a test result of type FAIL is added to the test log and a false value is returned. If the files are different a diff that shows which lines have changed is created which can be found in the test result message details.

The optional parameter options can be specified as a map or dictionary. So far the following options can be set:

  • strictLineEndings : If this is set to true the function will pick up if two files use different line endings (e.g., CR+LF on windows or LF on unix). The default is false.
//example 1: no options
test.compareTextFiles("expected.txt", "actual.txt");

//example 2: with options
test.compareTextFiles("expected.txt", "actual.txt", {'strictLineEndings': true});
#example 1: no options
test::compareTextFiles("expected.txt", "actual.txt");

#example 2: with options
test::compareTextFiles("expected.txt", "actual.txt", {"strictLineEndings" => 1});
#example 1: no options
test.compareTextFiles("expected.txt", "actual.txt")

#example 2: with options
test.compareTextFiles("expected.txt", "actual.txt", {'strictLineEndings': True})
#example 1: no options
Test.compareTextFiles("expected.txt", "actual.txt")

#example 2: with options
Test.compareTextFiles("expected.txt", "actual.txt", {'strictLineEndings' => True})
#example 1: no options
test compareTextFiles "expected.txt" "actual.txt"

#example 2: with options
test compareTextFiles "expected.txt" "actual.txt" [dict create strictLineEndings 1]

© 2024 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners.
The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation.
Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.

Search Results