diff --git a/CHANGELOG.md b/CHANGELOG.md index de879c5..d55dc5e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [Unreleased] +### Changed +- Source line reported by failure list changed to line containing `expect` instead of example start line. + ## [0.10.3] - 2021-10-13 ### Fixed - Fixed runtime error with `expect` outside of test block - now gives compilation error. @@ -358,6 +362,7 @@ This has been changed so that it compiles and raises an error at runtime with a First version ready for public use. +[Unreleased]: https://gitlab.com/arctic-fox/spectator/-/compare/v0.10.3...master [0.10.3]: https://gitlab.com/arctic-fox/spectator/-/compare/v0.10.2...v0.10.3 [0.10.2]: https://gitlab.com/arctic-fox/spectator/-/compare/v0.10.1...v0.10.2 [0.10.1]: https://gitlab.com/arctic-fox/spectator/-/compare/v0.10.0...v0.10.1 diff --git a/src/spectator/formatting/components/fail_result_block.cr b/src/spectator/formatting/components/fail_result_block.cr index 74b2f60..2f18528 100644 --- a/src/spectator/formatting/components/fail_result_block.cr +++ b/src/spectator/formatting/components/fail_result_block.cr @@ -45,5 +45,13 @@ module Spectator::Formatting::Components io << padding << key.colorize(:red) << ": ".colorize(:red) << value end end + + # Produces the location line. + # This is where the result was determined. + private def location_line(io) + return unless location = @expectation.location? || @example.location? + + line(io) { io << Comment.colorize(location) } + end end end