[Groonga-commit] ranguba/groonga-client at 4c676be [master] Ensure stringify number

Back to archive index

Kouhei Sutou null+****@clear*****
Fri Feb 3 09:33:35 JST 2017


Kouhei Sutou	2017-02-03 09:33:35 +0900 (Fri, 03 Feb 2017)

  New Revision: 4c676be1e86868d7b4654b73076be168b45ddc3a
  https://github.com/ranguba/groonga-client/commit/4c676be1e86868d7b4654b73076be168b45ddc3a

  Message:
    Ensure stringify number

  Modified files:
    lib/groonga/client/request/base.rb
    test/request/test-select.rb

  Modified: lib/groonga/client/request/base.rb (+2 -0)
===================================================================
--- lib/groonga/client/request/base.rb    2017-01-12 11:29:39 +0900 (6df029e)
+++ lib/groonga/client/request/base.rb    2017-02-03 09:33:35 +0900 (5acc04d)
@@ -88,6 +88,8 @@ module Groonga
           when String
             return {} if****@value*****?
             value = @value
+          when Numeric
+            value =****@value*****_s
           when NilClass
             return {}
           else

  Modified: test/request/test-select.rb (+46 -2)
===================================================================
--- test/request/test-select.rb    2017-01-12 11:29:39 +0900 (3de02f5)
+++ test/request/test-select.rb    2017-02-03 09:33:35 +0900 (f0c2114)
@@ -158,7 +158,7 @@ class TestRequestSelect < Test::Unit::TestCase
       test "Integer" do
         assert_equal({
                        :table => "posts",
-                       :"drilldowns[label].offset" => 29,
+                       :"drilldowns[label].offset" => "29",
                      },
                      drilldown.offset(29).to_parameters)
       end
@@ -168,7 +168,7 @@ class TestRequestSelect < Test::Unit::TestCase
       test "Integer" do
         assert_equal({
                        :table => "posts",
-                       :"drilldowns[label].limit" => 29,
+                       :"drilldowns[label].limit" => "29",
                      },
                      drilldown.limit(29).to_parameters)
       end
@@ -250,4 +250,48 @@ class TestRequestSelect < Test::Unit::TestCase
       end
     end
   end
+
+  sub_test_case("#paginate") do
+    def paginate(*args)
+      @request.paginate(*args).to_parameters
+    end
+
+    sub_test_case("page") do
+      test("0") do
+        assert_equal({
+                       :table  => "posts",
+                       :offset => "0",
+                       :limit  => "10",
+                     },
+                     paginate(0))
+      end
+
+      test("1") do
+        assert_equal({
+                       :table  => "posts",
+                       :offset => "0",
+                       :limit  => "10",
+                     },
+                     paginate(1))
+      end
+
+      test("positive") do
+        assert_equal({
+                       :table  => "posts",
+                       :offset => "80",
+                       :limit  => "10",
+                     },
+                     paginate(9))
+      end
+
+      test("negative") do
+        assert_equal({
+                       :table  => "posts",
+                       :offset => "0",
+                       :limit  => "10",
+                     },
+                     paginate(-1))
+      end
+    end
+  end
 end
-------------- next part --------------
HTML����������������������������...
Descargar 



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