[Groonga-commit] groonga/grntest [master] Use to_sym instead of literal

Back to archive index

Kouhei Sutou null+****@clear*****
Wed Nov 21 14:06:26 JST 2012


Kouhei Sutou	2012-11-21 14:06:26 +0900 (Wed, 21 Nov 2012)

  New Revision: 213e4e1ab61e91e3a58d995b87e02da661f35de0
  https://github.com/groonga/grntest/commit/213e4e1ab61e91e3a58d995b87e02da661f35de0

  Log:
    Use to_sym instead of literal

  Modified files:
    lib/grntest/tester.rb

  Modified: lib/grntest/tester.rb (+6 -7)
===================================================================
--- lib/grntest/tester.rb    2012-11-21 13:46:35 +0900 (7ef642b)
+++ lib/grntest/tester.rb    2012-11-21 14:06:26 +0900 (c9ed370)
@@ -1398,19 +1398,18 @@ EOF
       def execute_directive_on_error(line, content, options)
         action, = options
         invalid_value_p = false
-        case action
-        when "default"
-          @context.on_error = :default
-        when "omit"
-          @context.on_error = :omit
+        valid_actions = ["default", "omit"]
+        if valid_actions.include?(action)
+          @context.on_error = action.to_sym
         else
           invalid_value_p = true
         end
 
         if invalid_value_p
           log_input(line)
-          message = "on-error must be 'default' or 'omit': <#{action}>"
-          log_error("#|e| [on-error] #{message}")
+          valid_actions_label = "[#{valid_actions.join(', ')}]"
+          message = "on-error must be one of #{valid_actions_label}"
+          log_error("#|e| [on-error] #{message}: <#{action}>")
         end
       end
 
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Back to archive index