dart-lang / dart-lang/test

Add option to print expected and actual strings with triple quotes

Open
#2,350 0 comments 1 reaction 0 assignees View on GitHub
package:matcher
Dominant language
Dart
Stars
536
Forks
232
Avg merge
1d 10h
Merged PRs (30d)
10

Description

_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_

Contributor guide

Open the contributing guide

Research direction

Start by tracing the test failure output that produces the shown Expected/Actual string diff; the issue does not name a source file or test entry point. Add an option for diffs to use triple-quoted strings, and verify that long multiline expected and actual values are easier to read.

Written by the indexing model from the issue text.

Assessment

Tech stack
dart
Domain
testing
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.