inspec/lib/matchers
Jerry Aldrich 6381dd1b1d Modify cmp matcher output to use .inspect (#3450)
This modifies the output of failed test when using the `cmp` matcher by
calling `.inspect` on the actual value passed.

This makes it easier to diagnose failed matches due to characters such
as `\n` not being visible.

Current behavior:
```
inspec> describe command('echo demo') do
inspec>   its('stdout') { should cmp 'demo' }
inspec> end

Profile: inspec-shell
Version: (not specified)

  Command: `echo demo`
     ×  stdout should cmp == "demo"

     expected: "demo"
          got: demo

     (compared using `cmp` matcher)

Test Summary: 0 successful, 1 failure, 0 skipped
```

New behavior:
```
inspec> describe command('echo demo') do
inspec>   its('stdout') { should cmp 'demo' }
inspec> end

Profile: inspec-shell
Version: (not specified)

  Command: `echo demo`
     ×  stdout should cmp == "demo"

     expected: "demo"
          got: "demo\n"

     (compared using `cmp` matcher)

Test Summary: 0 successful, 1 failure, 0 skipped
```

Many thanks to @jazaval for discovering this!

Signed-off-by: Jerry Aldrich <jerryaldrichiii@gmail.com>
2018-10-02 15:27:48 -04:00
..
matchers.rb Modify cmp matcher output to use .inspect (#3450) 2018-10-02 15:27:48 -04:00