[Groonga-commit] groonga/grntest at 90fa330 [master] Remove needless tests

Back to archive index

Kouhei Sutou null+****@clear*****
Mon Aug 12 11:29:33 JST 2013


Kouhei Sutou	2013-08-12 11:29:33 +0900 (Mon, 12 Aug 2013)

  New Revision: 90fa33069f4553d1994596d68e6ae8a194dbbeb5
  https://github.com/groonga/grntest/commit/90fa33069f4553d1994596d68e6ae8a194dbbeb5

  Message:
    Remove needless tests
    
    Command format conversion feature moves to groonga-command library.

  Modified files:
    test/test-executor.rb

  Modified: test/test-executor.rb (+0 -146)
===================================================================
--- test/test-executor.rb    2013-03-14 21:55:04 +0900 (143db5e)
+++ test/test-executor.rb    2013-08-12 11:29:33 +0900 (8efb110)
@@ -58,150 +58,4 @@ class TestExecutor < Test::Unit::TestCase
       assert_equal(:omit, @context.on_error)
     end
   end
-
-  class TestCommandFormatConveter < self
-    def test_without_argument_name
-      command = "table_create Site TABLE_HASH_KEY ShortText"
-      arguments = {
-        "name" => "Site",
-        "flags" => "TABLE_HASH_KEY",
-        "key_type" => "ShortText",
-      }
-      actual_url = convert(command)
-      expected_url = build_url("table_create", arguments)
-
-      assert_equal(expected_url, actual_url)
-    end
-
-    def test_with_argument_name
-      command = "select --table Sites"
-      actual_url = convert(command)
-      expected_url = build_url("select", "table" => "Sites")
-
-      assert_equal(expected_url, actual_url)
-    end
-
-    def test_non_named_argument_after_named_arguement
-      command = "table_create --flags TABLE_HASH_KEY --key_type ShortText Site"
-      arguments = {
-        "flags" => "TABLE_HASH_KEY",
-        "key_type" => "ShortText",
-        "name" => "Site",
-      }
-      actual_url = convert(command)
-      expected_url = build_url("table_create", arguments)
-
-      assert_equal(expected_url, actual_url)
-    end
-
-    def test_without_arguments
-      command = "dump"
-      actual_url = convert(command)
-      expected_url = build_url(command, {})
-
-      assert_equal(expected_url, actual_url)
-    end
-
-    def test_load_json_array
-      load_command = "load --table Sites"
-      load_values = <<EOF
-[
-["_key","uri"],
-["groonga","http://groonga.org/"],
-["razil","http://razil.jp/"]
-]
-EOF
-      command = "#{load_command}\n#{load_values}"
-      actual_url = convert(command)
-
-      load_values_without_columns =
-        '[["groonga","http://groonga.org/"],["razil","http://razil.jp/"]]'
-      arguments = {
-        "table" => "Sites",
-        "columns" => "_key,uri",
-        "values" => load_values_without_columns
-      }
-      expected_url = build_url("load", arguments)
-
-      assert_equal(expected_url, actual_url)
-    end
-
-    def test_load_json_object
-      load_command = "load --table Sites"
-      load_values = <<EOF
-[
-{"_key": "ruby", "uri": "http://ruby-lang.org/"}
-]
-EOF
-      command = "#{load_command}\n#{load_values}"
-      actual_url = convert(command)
-
-      arguments = {
-        "table" => "Sites",
-        "values" => '[{"_key":"ruby","uri":"http://ruby-lang.org/"}]'
-      }
-      expected_url = build_url("load", arguments)
-
-      assert_equal(expected_url, actual_url)
-    end
-
-    def test_value_single_quote
-      command = "select Sites --output_columns '_key, uri'"
-      arguments = {
-        "table" => "Sites",
-        "output_columns" => "_key, uri",
-      }
-      actual_url = convert(command)
-      expected_url = build_url("select", arguments)
-
-      assert_equal(expected_url, actual_url)
-    end
-
-    def test_value_double_quote_in_single_quote
-      command = "select Sites --filter 'uri @ \"ruby\"'"
-      arguments = {
-        "table" => "Sites",
-        "filter" => "uri @ \"ruby\"",
-      }
-      actual_url = convert(command)
-      expected_url = build_url("select", arguments)
-
-      assert_equal(expected_url, actual_url)
-    end
-
-    def test_value_double_quote
-      command = "select Sites --output_columns \"_key, uri\""
-      arguments = {
-        "table" => "Sites",
-        "output_columns" => "_key, uri",
-      }
-      actual_url = convert(command)
-      expected_url = build_url("select", arguments)
-
-      assert_equal(expected_url, actual_url)
-    end
-
-    private
-    def convert(command)
-      converter = Grntest::Tester::CommandFormatConverter.new(command)
-      converter.to_url
-    end
-
-    def build_url(command, named_arguments)
-      url = "/d/#{command}"
-      query_parameters = []
-
-      sorted_arguments = named_arguments.sort_by do |name, _|
-        name
-      end
-      sorted_arguments.each do |name, argument|
-        query_parameters << "#{CGI.escape(name)}=#{CGI.escape(argument)}"
-      end
-      unless query_parameters.empty?
-        url << "?"
-        url << query_parameters.join("&")
-      end
-      url
-    end
-  end
 end
-------------- next part --------------
HTML����������������������������...
다운로드 



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