[Groonga-commit] ranguba/groonga-client at e731153 [master] test: add string page case

Back to archive index

Kouhei Sutou null+****@clear*****
Fri Feb 3 09:53:02 JST 2017


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

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

  Message:
    test: add string page case

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

  Modified: lib/groonga/client/request/select.rb (+3 -0)
===================================================================
--- lib/groonga/client/request/select.rb    2017-02-03 09:40:46 +0900 (92465b1)
+++ lib/groonga/client/request/select.rb    2017-02-03 09:53:02 +0900 (e316d8d)
@@ -114,6 +114,9 @@ module Groonga
         def paginate(page, per_page: 10)
           page ||= 1
           page = page.to_i
+          per_page = per_page.to_i
+          per_page = 10 if per_page <= 0
+
           if page <= 0
             offset = 0
           else

  Modified: test/request/test-select.rb (+9 -0)
===================================================================
--- test/request/test-select.rb    2017-02-03 09:40:46 +0900 (18441b8)
+++ test/request/test-select.rb    2017-02-03 09:53:02 +0900 (8b2a228)
@@ -301,6 +301,15 @@ class TestRequestSelect < Test::Unit::TestCase
                      },
                      paginate(-1))
       end
+
+      test("string") do
+        assert_equal({
+                       :table  => "posts",
+                       :offset => "80",
+                       :limit  => "10",
+                     },
+                     paginate("9"))
+      end
     end
   end
 end
-------------- next part --------------
HTML����������������������������...
Download 



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