matcher icon indicating copy to clipboard operation
matcher copied to clipboard

Add option to print expected and actual strings with triple quotes

Open nex3 opened this issue 9 years ago • 0 comments

From @skybrian on May 27, 2016 2:31

For example, this is not terribly readable:

  Expected: '///\n'
    '//  Generated code. Do not modify.\n'
    '///\n'
    'library test;\n'
    '\n'
    'import \'dart:async\';\n'
    '\n'
    'import \'package:protobuf/protobuf.dart\';\n'
    '\n'
    ''
    Actual: '///\n'
    '//  Generated code. Do not modify.\n'
    '///\n'
    'library test;\n'
    '\n'
    'import \'dart:async\';\n'
    '\n'
    'import \'package:protobuf/protobuf.dart\';\n'
    '\n'
    'class Api {\n'
    '  RpcClient _client;\n'
    '  Api(this._client);\n'
    '\n'
    '}\n'
    '\n'
    ''
     Which: is different. Both strings start the same, but the given value also has the following trailing characters: class Api  ...

Since I use triple-quoted strings for expected data, updating the test is a bit tedious. It would be nicer if there were an option to print diffs using triple-quoted strings. It would also make the output easier to read.

Copied from original issue: dart-lang/test#435

nex3 avatar May 27 '16 17:05 nex3