couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kxe...@apache.org
Subject [04/36] couchdb commit: updated refs/heads/1963-eunit to 85f2750
Date Tue, 03 Jun 2014 15:54:42 GMT
Port 002-icu-driver.t etap test suite to eunit

See setup/0 comment for specific info about loading
couch_icu_driver with eunit.


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

Branch: refs/heads/1963-eunit
Commit: d4b721ffd5d74a8ed559a7e225468c76c3f75522
Parents: a57684c
Author: Alexander Shorin <kxepal@apache.org>
Authored: Fri May 16 05:19:05 2014 +0400
Committer: Alexander Shorin <kxepal@apache.org>
Committed: Tue Jun 3 02:54:34 2014 +0400

----------------------------------------------------------------------
 test/couchdb/Makefile.am          |  1 +
 test/couchdb/couch_util_tests.erl | 58 ++++++++++++++++++++++++++++++++++
 test/etap/002-icu-driver.t        | 33 -------------------
 test/etap/Makefile.am             |  1 -
 4 files changed, 59 insertions(+), 34 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb/blob/d4b721ff/test/couchdb/Makefile.am
----------------------------------------------------------------------
diff --git a/test/couchdb/Makefile.am b/test/couchdb/Makefile.am
index 4802082..8607049 100644
--- a/test/couchdb/Makefile.am
+++ b/test/couchdb/Makefile.am
@@ -18,6 +18,7 @@ all:
 
 eunit_files = \
     couchdb_modules_load_tests.erl \
+    couch_util_tests.erl \
     couchdb_tests.hrl
 
 EXTRA_DIST = \

http://git-wip-us.apache.org/repos/asf/couchdb/blob/d4b721ff/test/couchdb/couch_util_tests.erl
----------------------------------------------------------------------
diff --git a/test/couchdb/couch_util_tests.erl b/test/couchdb/couch_util_tests.erl
new file mode 100644
index 0000000..49688e2
--- /dev/null
+++ b/test/couchdb/couch_util_tests.erl
@@ -0,0 +1,58 @@
+% Licensed under the Apache License, Version 2.0 (the "License"); you may not
+% use this file except in compliance with the License. You may obtain a copy of
+% the License at
+%
+%   http://www.apache.org/licenses/LICENSE-2.0
+%
+% Unless required by applicable law or agreed to in writing, software
+% distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+% WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+% License for the specific language governing permissions and limitations under
+% the License.
+
+
+-module(couch_util_tests).
+
+-include_lib("couchdb_tests.hrl").
+
+
+setup() ->
+    %% We cannot start driver from here since it becomes bounded to eunit
+    %% master process and the next couch_server_sup:start_link call will
+    %% fail because server couldn't load driver since it already is.
+    %%
+    %% On other hand, we cannot unload driver here due to
+    %% {error, not_loaded_by_this_process} while it is. Any ideas is welcome.
+    %%
+    couch_server_sup:start_link(?CONFIG_CHAIN),
+    %% couch_config:start_link(?CONFIG_CHAIN),
+    %% {ok, _} = couch_drv:start_link(),
+    ok.
+
+teardown(_) ->
+    couch_server_sup:stop(),
+    %% couch_config:stop(),
+    %% erl_ddll:unload_driver(couch_icu_driver),
+    ok.
+
+
+collation_test_() ->
+    {
+        "Collation tests",
+        [
+            {
+                setup,
+                fun setup/0, fun teardown/1,
+                [
+                    should_collate_ascii(),
+                    should_collate_non_ascii()
+                ]
+            }
+        ]
+    }.
+
+should_collate_ascii() ->
+    ?_assertEqual(1, couch_util:collate(<<"foo">>, <<"bar">>)).
+
+should_collate_non_ascii() ->
+    ?_assertEqual(-1, couch_util:collate(<<"A">>, <<"aa">>)).

http://git-wip-us.apache.org/repos/asf/couchdb/blob/d4b721ff/test/etap/002-icu-driver.t
----------------------------------------------------------------------
diff --git a/test/etap/002-icu-driver.t b/test/etap/002-icu-driver.t
deleted file mode 100755
index e233533..0000000
--- a/test/etap/002-icu-driver.t
+++ /dev/null
@@ -1,33 +0,0 @@
-#!/usr/bin/env escript
-% Licensed under the Apache License, Version 2.0 (the "License"); you may not
-% use this file except in compliance with the License. You may obtain a copy of
-% the License at
-%
-%   http://www.apache.org/licenses/LICENSE-2.0
-%
-% Unless required by applicable law or agreed to in writing, software
-% distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-% WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-% License for the specific language governing permissions and limitations under
-% the License.
-
-main(_) ->
-    test_util:init_code_path(),
-    couch_config:start_link(test_util:config_files()),
-    etap:plan(3),
-    etap:is(
-        element(1, couch_drv:start_link()),
-        ok,
-        "Started couch_icu_driver."
-    ),
-    etap:is(
-        couch_util:collate(<<"foo">>, <<"bar">>),
-        1,
-        "Can collate stuff"
-    ),
-    etap:is(
-        couch_util:collate(<<"A">>, <<"aa">>),
-        -1,
-        "Collate's non-ascii style."
-    ),
-    etap:end_tests().

http://git-wip-us.apache.org/repos/asf/couchdb/blob/d4b721ff/test/etap/Makefile.am
----------------------------------------------------------------------
diff --git a/test/etap/Makefile.am b/test/etap/Makefile.am
index ff7f730..9a67ed7 100644
--- a/test/etap/Makefile.am
+++ b/test/etap/Makefile.am
@@ -36,7 +36,6 @@ fixture_files = \
     fixtures/test.couch
 
 tap_files = \
-    002-icu-driver.t \
     010-file-basics.t \
     011-file-headers.t \
     020-btree-basics.t \


Mime
View raw message