Skip to content
This repository
Browse code

silence warning: possibly useless use of a constant in void context

  • Loading branch information...
commit 180e2e5e9e9aac7123f94eda61144241566b445d 1 parent 6ed4ad1
Toshinori Kajihara authored December 06, 2012

Showing 1 changed file with 7 additions and 3 deletions. Show diff stats Hide diff stats

  1. 10  activesupport/test/dependencies_test.rb
10  activesupport/test/dependencies_test.rb
@@ -923,8 +923,10 @@ def test_remove_constant_does_not_trigger_loading_autoloads
923 923
 
924 924
   def test_remove_constant_does_not_autoload_already_removed_parents_as_a_side_effect
925 925
     with_autoloading_fixtures do
926  
-      ::A
927  
-      ::A::B
  926
+      silence_warnings do
  927
+        ::A
  928
+        ::A::B
  929
+      end
928 930
       ActiveSupport::Dependencies.remove_constant('A')
929 931
       ActiveSupport::Dependencies.remove_constant('A::B')
930 932
       assert !defined?(A)
@@ -934,7 +936,9 @@ def test_remove_constant_does_not_autoload_already_removed_parents_as_a_side_eff
934 936
   def test_load_once_constants_should_not_be_unloaded
935 937
     with_autoloading_fixtures do
936 938
       ActiveSupport::Dependencies.autoload_once_paths = ActiveSupport::Dependencies.autoload_paths
937  
-      ::A.to_s
  939
+      silence_warnings do
  940
+        ::A
  941
+      end
938 942
       assert defined?(A)
939 943
       ActiveSupport::Dependencies.clear
940 944
       assert defined?(A)

0 notes on commit 180e2e5

Rafael Mendonça França

This line is still printing a warning.

/Users/rafaelmfranca/Projects/github/rails/activesupport/test/dependencies_test.rb:927: warning: possibly useless use of :: in void context

Any idea how to fix?

cc/ @fxn

Xavier Noria

How interesting.

Other similar warnings in this file are silenced by silence_warnings but not the one in line 927. Even more puzzling, if you add p 1 at the top of the file you'll see 1 printed after the warning. As if the warning was issued at parse time. Can't make sense of everything together. I'll investigate.

Xavier Noria

Mistery solved in 26c024e, Merry Christmas Rafael!

Rafael Mendonça França

OMG! Merry Christmas to you too :heart:

Please sign in to comment.
Something went wrong with that request. Please try again.