[Groonga-commit] ranguba/rroonga at 0e9e8cb [master] test: add missing tests for small/medium index column inspection

アーカイブの一覧に戻る

Kouhei Sutou null+****@clear*****
Sat Nov 5 16:16:12 JST 2016


Kouhei Sutou	2016-11-05 16:16:12 +0900 (Sat, 05 Nov 2016)

  New Revision: 0e9e8cb5cf099e388984436b156b875ed76ce6cd
  https://github.com/ranguba/rroonga/commit/0e9e8cb5cf099e388984436b156b875ed76ce6cd

  Message:
    test: add missing tests for small/medium index column inspection

  Modified files:
    test/test-index-column.rb

  Modified: test/test-index-column.rb (+63 -1)
===================================================================
--- test/test-index-column.rb    2016-11-05 16:11:14 +0900 (ff3b54c)
+++ test/test-index-column.rb    2016-11-05 16:16:12 +0900 (dc20fe3)
@@ -1,6 +1,6 @@
 # -*- coding: utf-8 -*-
 #
-# Copyright (C) 2009-2015  Kouhei Sutou <kou �� clear-code.com>
+# Copyright (C) 2009-2016  Kouhei Sutou <kou �� clear-code.com>
 # Copyright (C) 2016  Masafumi Yokoyama <yokoyama �� clear-code.com>
 #
 # This library is free software; you can redistribute it and/or
@@ -743,4 +743,66 @@ class IndexColumnTest < Test::Unit::TestCase
       end
     end
   end
+
+  class InspectTest < self
+    def setup
+      super
+      setup_source
+    end
+
+    def setup_source
+      Groonga::Schema.define do |schema|
+        schema.create_table("Articles") do |article|
+          article.text(:content)
+          article.short_text(:tag)
+        end
+      end
+    end
+
+    def test_small_size
+      Groonga::Schema.define do |schema|
+        schema.create_table("Tags",
+                            :type => :hash,
+                            :key_type => "ShortText") do |tags|
+          tags.index("Articles.tag", :size => :small)
+        end
+      end
+
+      index = context["Tags.Articles_tag"]
+      source_column_names = index.sources.collect(&:local_name).join(",")
+      assert_equal("\#<Groonga::IndexColumn " +
+                   "id: <#{index.id}>, " +
+                   "name: <#{index.name}>, " +
+                   "path: <#{index.path}>, " +
+                   "domain: <#{index.domain.name}>, " +
+                   "range: <#{index.range.name}>, " +
+                   "flags: <SMALL>, " +
+                   "sources: <#{source_column_names}>" +
+                   ">",
+                   index.inspect)
+    end
+
+    def test_medium_size
+      Groonga::Schema.define do |schema|
+        schema.create_table("Tags",
+                            :type => :hash,
+                            :key_type => "ShortText") do |tags|
+          tags.index("Articles.tag", :size => :medium)
+        end
+      end
+
+      index = context["Tags.Articles_tag"]
+      source_column_names = index.sources.collect(&:local_name).join(",")
+      assert_equal("\#<Groonga::IndexColumn " +
+                   "id: <#{index.id}>, " +
+                   "name: <#{index.name}>, " +
+                   "path: <#{index.path}>, " +
+                   "domain: <#{index.domain.name}>, " +
+                   "range: <#{index.range.name}>, " +
+                   "flags: <MEDIUM>, " +
+                   "sources: <#{source_column_names}>" +
+                   ">",
+                   index.inspect)
+    end
+  end
 end
-------------- next part --------------
HTML����������������������������...
ダウンロード 



More information about the Groonga-commit mailing list
アーカイブの一覧に戻る