Navigation Menu

Skip to content

Commit

Permalink
Merge pull request #72 from ranguba/normalize-token-regexp-type
Browse files Browse the repository at this point in the history
Normalize TokenRegexp type
  • Loading branch information
kou committed Apr 2, 2015
2 parents 03fe504 + 980ba27 commit 6f52262
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/groonga/schema.rb
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2009-2014 Kouhei Sutou <kou@clear-code.com>
# Copyright (C) 2014 Masafumi Yokoyama <myokoym@gmail.com>
# Copyright (C) 2014-2015 Masafumi Yokoyama <yokoyama@clear-code.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
Expand Down Expand Up @@ -598,6 +598,8 @@ def restore(dumped_text, options={})
"token_trigram" => "TokenTrigram",
"mecab" => "TokenMecab",
"token_mecab"=> "TokenMecab",
"regexp" => "TokenRegexp",
"token_regexp"=> "TokenRegexp",
}
# @private
def normalize_type(type, options={})
Expand Down
14 changes: 14 additions & 0 deletions test/test-schema-type.rb
Expand Up @@ -205,4 +205,18 @@ def test_normalize_mecab
def assert_normalize_type(expected, type)
assert_equal(expected, Groonga::Schema.normalize_type(type))
end

class RegexpTest < self
def test_normalize_short_name
assert_normalize_type("TokenRegexp", "regexp")
end

def test_normalize_snake_case
assert_normalize_type("TokenRegexp", "token_regexp")
end

def test_normalize_camel_case
assert_normalize_type("TokenRegexp", "TokenRegexp")
end
end
end

0 comments on commit 6f52262

Please sign in to comment.