Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fail when =contains=> targets a non-map value #399

Merged
merged 2 commits into from
Aug 16, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 5 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
# Change Log
This project adheres to [Semantic Versioning](http://semver.org/).
This project adheres to [Semantic Versioning](http://semver.org/).
See [here](http://keepachangelog.com/) for the change log format.

## [1.9.0-alpha9] - 2017-08-03
- Fail when `=contains=>` targets a non-map value, which has unclear semantics

## [1.9.0-alpha8] - 2017-07-04
Fixed issues:
- 389: Midje throws exception when using prerequisites for stubbing function with specific arguments
Expand Down Expand Up @@ -43,7 +46,7 @@ Fixed issues:
- NOTE NOTE NOTE: Previous should be documented before 1.9.0 is released.
- This is the last version compatible with Specter 0.9.X

## [1.8.3]
## [1.8.3]
- Bump to newer versions of dependencies

## [1.8.2]
Expand Down
2 changes: 1 addition & 1 deletion project.clj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(defproject midje "1.9.0-alpha8"
(defproject midje "1.9.0-alpha9"
Copy link
Collaborator Author

@philomates philomates Aug 3, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Figure this is worth releasing because #390, released in alpha8, makes it more probable that users will hit the buggy logic in merge-metaconstants when trying to use =contains=> with lists.

: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
Expand Down
6 changes: 5 additions & 1 deletion src/midje/parsing/2_to_lexical_maps/data_fakes.clj
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@
(cond (not (metaconstant/metaconstant-symbol? metaconstant))
(error/report-error form
(cl-format nil "In `~A ~A ~A`, ~A is not a metaconstant."
metaconstant arrow contained metaconstant)))
metaconstant arrow contained metaconstant))
(not (map? contained))
(error/report-error form
(cl-format nil "In `~A ~A ~A`, ~A is not a map."
metaconstant arrow contained contained)))
[metaconstant arrow contained overrides])

(def assert-valid! valid-pieces)
Expand Down
13 changes: 13 additions & 0 deletions test/midje/data/t_metaconstant.clj
Original file line number Diff line number Diff line change
Expand Up @@ -189,3 +189,16 @@
..doc.. =contains=> {:header (rand)}
(gen-doc) => ..doc..))

(silent-fact
(first (gen-doc)) => "list"
(provided
(gen-doc) => ..doc..
..doc.. =contains=> ["list" "contains" "not" "supported"]))
(note-that fact-fails, (fact-failed-with-note #".*is not a map"))

(silent-fact
(first (gen-doc)) => \s
(provided
(gen-doc) => ..doc..
..doc.. =contains=> "should fail"))
(note-that fact-fails, (fact-failed-with-note #".*is not a map"))
2 changes: 1 addition & 1 deletion test/midje/parsing/1_to_explicit_form/t_metaconstants.clj
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
(let [c 'c]
(concer ...source...) => "abc"
(provided
...source... =contains=> '{:a a, :b b}
...source... =contains=> {:a 'a, :b 'b}
...source... =contains=> {:c c})))


Expand Down