You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by to...@apache.org on 2015/09/10 02:34:17 UTC

[15/26] couchdb-mango git commit: add tests

add tests


Project: http://git-wip-us.apache.org/repos/asf/couchdb-mango/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-mango/commit/97162fd5
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-mango/tree/97162fd5
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-mango/diff/97162fd5

Branch: refs/heads/master
Commit: 97162fd5d9fcddbdc95495565076066ca091c481
Parents: 7032bf5
Author: Tony Sun <to...@cloudant.com>
Authored: Wed Aug 26 01:52:19 2015 -0700
Committer: Tony Sun <to...@cloudant.com>
Committed: Wed Aug 26 01:52:19 2015 -0700

----------------------------------------------------------------------
 src/mango_util.erl | 12 ++++++++++++
 1 file changed, 12 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-mango/blob/97162fd5/src/mango_util.erl
----------------------------------------------------------------------
diff --git a/src/mango_util.erl b/src/mango_util.erl
index 0e71312..2d25bdc 100644
--- a/src/mango_util.erl
+++ b/src/mango_util.erl
@@ -407,4 +407,16 @@ parse_field_test() ->
     Exception = {mango_error, ?MODULE, {invalid_field_name, <<"a..b">>}},
     ?assertThrow(Exception, parse_field(<<"a..b">>)).
 
+is_number_string_test() ->
+    ?assert(is_number_string("0")),
+    ?assert(is_number_string("1")),
+    ?assert(is_number_string("1.0")),
+    ?assert(is_number_string("1.0E10")),
+    ?assert(is_number_string("0d")),
+    ?assert(is_number_string("-1")),
+    ?assert(is_number_string("-1.0")),
+    ?assertNot(is_number_string("hello")),
+    ?assertNot(is_number_string("")),
+    ?assertMatch({re_pattern, _, _, _, _}, mochiglobal:get(mango_numstring_re)).
+
 -endif.