Permalink
Browse files

Print linebreaks in failure messages (#454)

* doc fixes

* remove pr-str in failure-notice

* bump version
  • Loading branch information...
philomates committed Jan 17, 2019
1 parent afeb217 commit 928d9e68723d3ce8cf41ee114bffb17a848bbe93
Showing with 13 additions and 8 deletions.
  1. +3 −0 CHANGELOG.md
  2. +1 −1 project.clj
  3. +6 −6 src/midje/emission/plugins/util.clj
  4. +3 −1 test/midje/emission/plugins/t_util.clj
@@ -2,6 +2,9 @@
This project adheres to [Semantic Versioning](http://semver.org/).
See [here](http://keepachangelog.com/) for the change log format.

## [1.9.6] - 2019-01-16
- correctly print linebreaks in failure messages

## [1.9.5] - 2019-01-08
- Introduce `midje.experimental/gen-let` macro for combining generative matchers

@@ -1,4 +1,4 @@
(defproject midje "1.9.5"
(defproject midje "1.9.6"
:description "A TDD library for Clojure that supports top-down ('mockish') TDD, encourages readable tests, provides a smooth migration path from clojure.test, balances abstraction and concreteness, and strives for graciousness."
:url "https://github.com/marick/Midje"
:pedantic? :warn
@@ -1,5 +1,5 @@
(ns ^{:doc "General purpose plugin utilities"}
midje.emission.plugins.util
(ns midje.emission.plugins.util
"General purpose plugin utilities"
(:require [clojure.repl :refer [demunge]]
[clojure.string :as str]
[puget.printer :as puget]
@@ -177,13 +177,13 @@


(defn failure-notice
"The reader's eye is guided by a bright red FAIL, the filename and lineno, and
"The reader's eye is guided by a bright red FAIL, the filename and line-number, and
perhaps this other information:
: the descriptions of all enclosing facts, if any
: notes on which bindings were supplied to a tabular fact"
- the descriptions of all enclosing facts, if any
- notes on which bindings were supplied to a tabular fact"
[m]
(let [description (when-let [doc (format-nested-descriptions (:description m))]
(str (pr-str doc) " "))
(str doc " "))
position (position-str (:position m) (:namespace m))
table-substitutions (when (:midje/table-bindings m)
(str "With table substitutions: " (format-binding-map (:midje/table-bindings m))))]
@@ -69,7 +69,9 @@
(failure-notice {:position ["filename" 10]})
=> (just #"FAIL\S* at \(filename:10\)" nil)
(failure-notice {:position ["filename" 10] :description ["outer" nil "inner"]})
=> (just #"FAIL\S* \"outer - inner\" at \(filename:10\)" nil)
=> (just #"FAIL\S* outer - inner at \(filename:10\)" nil)
(failure-notice {:position ["filename" 10] :description ["multi\nline" nil "inner"]})
=> (just #"FAIL\S* multi\nline - inner at \(filename:10\)" nil)
(failure-notice {:position ["filename" 10] :midje/table-bindings '{?a 1}})
=> (just #"FAIL\S* at \(filename:10\)"
"With table substitutions: [?a 1]")

0 comments on commit 928d9e6

Please sign in to comment.