Skip to content

Commit

Permalink
add test for issue #12
Browse files Browse the repository at this point in the history
  • Loading branch information
pragdave committed Jul 17, 2017
1 parent 7622696 commit 31bdada
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 9 deletions.
23 changes: 15 additions & 8 deletions mix.exs
Original file line number Diff line number Diff line change
@@ -1,20 +1,27 @@
defmodule Quixir.Mixfile do
use Mix.Project

@version "0.9.2"
@version "0.9.3"

@package [
licenses: ["apache 2.0"],
maintainers: ["Dave Thomas (pragdave) <[email protected]>"],
licenses: [ "apache 2.0" ],
maintainers: [ "Dave Thomas (pragdave) <[email protected]>" ],
links: %{
"Github" => "https://github.com/pragdave/quixir",
},
]

@deps [
{ :pollution, "~> 0.9.1" },
{ :ex_doc, ">= 0.0.0", only: [:dev, :test] },
]
if System.get_env("THIS_IS_THE_REAL_ME") == "dave" do
@deps [
{ :pollution, [ path: "../pollution" ] },
{ :ex_doc, ">= 0.0.0", only: [ :dev, :test ] },
]
else
@deps [
{ :pollution, "~> 0.9.2" },
{ :ex_doc, ">= 0.0.0", only: [ :dev, :test ] },
]
end

@docs [
extras: [ "README.md" ],
Expand All @@ -31,7 +38,7 @@ defmodule Quixir.Mixfile do
@project [
app: :quixir,
version: @version,
elixir: "~> 1.3",
elixir: ">= 1.3.0",
elixirc_paths: @elixirc_paths,
build_embedded: @if_production,
start_permanent: @if_production,
Expand Down
17 changes: 16 additions & 1 deletion test/shrink_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,20 @@ defmodule ShrinkTest do
end
end


test "issue #12: constraints not honored when shrinking choose" do
# Shrinking should stop at 1
assert_raise ExUnit.AssertionError, ~r/a = 1/, fn ->
ptest(a: positive_int()) do
assert a < 0
end
end

# Shrinking should stop at 1 if the only choice is a positive int
assert_raise ExUnit.AssertionError, ~r/b = 1/, fn ->
ptest(b: choose( from: [ positive_int() ])) do
assert b < 0
end
end
end

end

0 comments on commit 31bdada

Please sign in to comment.