@@ -177,13 +177,16 @@ defmodule ExUnit.Assertions do
177177      { args ,  value }  =  extract_args ( assertion ,  __CALLER__ ) 
178178
179179      quote  generated:  true  do 
180-         if  value  =  unquote ( value )  do 
181-           value 
182-         else 
183-           raise  ExUnit.AssertionError , 
184-             args:  unquote ( args ) , 
185-             expr:  unquote ( escape_quoted ( :assert ,  [ ] ,  assertion ) ) , 
186-             message:  "Expected truthy, got #{ inspect ( value ) }  
180+         # not using `if` here because we don't want :generated to be propagated and suppress warnings 
181+         case  unquote ( value )  do 
182+           falsy  when  falsy  in  [ false ,  nil ]  -> 
183+             raise  ExUnit.AssertionError , 
184+               args:  unquote ( args ) , 
185+               expr:  unquote ( escape_quoted ( :assert ,  [ ] ,  assertion ) ) , 
186+               message:  "Expected truthy, got #{ inspect ( falsy ) }  
187+ 
188+           truthy  -> 
189+             truthy 
187190        end 
188191      end 
189192    end 
@@ -238,13 +241,16 @@ defmodule ExUnit.Assertions do
238241      { args ,  value }  =  extract_args ( assertion ,  __CALLER__ ) 
239242
240243      quote  generated:  true  do 
241-         if  value  =  unquote ( value )  do 
242-           raise  ExUnit.AssertionError , 
243-             args:  unquote ( args ) , 
244-             expr:  unquote ( escape_quoted ( :refute ,  [ ] ,  assertion ) ) , 
245-             message:  "Expected false or nil, got #{ inspect ( value ) }  
246-         else 
247-           value 
244+         # not using `if` here because we don't want :generated to be propagated and suppress warnings 
245+         case  unquote ( value )  do 
246+           falsy  when  falsy  in  [ false ,  nil ]  -> 
247+             falsy 
248+ 
249+           truthy  -> 
250+             raise  ExUnit.AssertionError , 
251+               args:  unquote ( args ) , 
252+               expr:  unquote ( escape_quoted ( :refute ,  [ ] ,  assertion ) ) , 
253+               message:  "Expected false or nil, got #{ inspect ( truthy ) }  
248254        end 
249255      end 
250256    end 
0 commit comments