You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by kx...@apache.org on 2014/06/03 06:50:23 UTC
[04/31] couchdb commit: updated refs/heads/1963-eunit to 16528f8
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/edbab49f
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/edbab49f
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/edbab49f
Branch: refs/heads/1963-eunit
Commit: edbab49fe21c8af63c268bcfb2bb03424ee34691
Parents: c95ec04
Author: Alexander Shorin <kx...@gmail.com>
Authored: Fri May 16 05:19:05 2014 +0400
Committer: Alexander Shorin <kx...@gmail.com>
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/edbab49f/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/edbab49f/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/edbab49f/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/edbab49f/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 \