couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tonysu...@apache.org
Subject [15/26] couchdb-mango git commit: add tests
Date Thu, 10 Sep 2015 00:34:17 GMT
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 <tony.sun@cloudant.com>
Authored: Wed Aug 26 01:52:19 2015 -0700
Committer: Tony Sun <tony.sun@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.


Mime
View raw message