[Groonga-commit] groonga/grntest [master] Support XML output normalization

Back to archive index

Kouhei Sutou null+****@clear*****
Fri Dec 21 11:48:21 JST 2012


Kouhei Sutou	2012-12-21 11:48:21 +0900 (Fri, 21 Dec 2012)

  New Revision: 0c543f42ca6646fcd97d19ff8c4590c7cb3d821f
  https://github.com/groonga/grntest/commit/0c543f42ca6646fcd97d19ff8c4590c7cb3d821f

  Log:
    Support XML output normalization

  Modified files:
    lib/grntest/tester.rb

  Modified: lib/grntest/tester.rb (+9 -0)
===================================================================
--- lib/grntest/tester.rb    2012-12-21 11:35:34 +0900 (0d5817e)
+++ lib/grntest/tester.rb    2012-12-21 11:48:21 +0900 (e788287)
@@ -1104,11 +1104,20 @@ EOF
             normalized_output = JSON.pretty_generate(normalized_output_content)
           end
           normalize_raw_content(normalized_output)
+        when "xml"
+          normalized_xml = normalize_output_xml(content, options)
+          normalize_raw_content(normalized_xml)
         else
           normalize_raw_content(content)
         end
       end
 
+      def normalize_output_xml(content, options)
+        content.sub(/^<RESULT .+?>/) do |result|
+          result.gsub(/( (?:UP|ELAPSED))="\d+\.\d+"/, '\1="0.0"')
+        end
+      end
+
       def normalize_status(status)
         return_code, started_time, elapsed_time, *rest = status
         _ = started_time = elapsed_time # for suppress warnings
-------------- next part --------------
HTML����������������������������...
Télécharger 



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