summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAdam Kocoloski <kocolosk@apache.org>2010-05-04 02:01:00 +0000
committerAdam Kocoloski <kocolosk@apache.org>2010-05-04 02:01:00 +0000
commit33b3524268195a0798993690b54cead286da28fb (patch)
tree3522835f347d8671d44a9e9f966bd3fc4604699e /test
parentc2ddcc5d1c5fcbe712031df19ecc12c781d8b613 (diff)
use keysearch BIF to search ejson props. Closes COUCHDB-747
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@940708 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'test')
-rwxr-xr-xtest/etap/090-task-status.t4
-rwxr-xr-xtest/etap/110-replication-httpc.t4
-rwxr-xr-xtest/etap/111-replication-changes-feed.t4
-rwxr-xr-xtest/etap/121-stats-aggregates.t4
-rwxr-xr-xtest/etap/140-attachment-comp.t30
-rw-r--r--test/view_server/query_server_spec.rb40
6 files changed, 43 insertions, 43 deletions
diff --git a/test/etap/090-task-status.t b/test/etap/090-task-status.t
index b6ebbe4c..b278de7f 100755
--- a/test/etap/090-task-status.t
+++ b/test/etap/090-task-status.t
@@ -29,7 +29,7 @@ check_status(Pid,ListPropLists) ->
From = list_to_binary(pid_to_list(Pid)),
Element = lists:foldl(
fun(PropList,Acc) ->
- case proplists:get_value(pid,PropList) of
+ case couch_util:get_value(pid,PropList) of
From ->
[PropList | Acc];
_ ->
@@ -38,7 +38,7 @@ check_status(Pid,ListPropLists) ->
end,
[], ListPropLists
),
- proplists:get_value(status,hd(Element)).
+ couch_util:get_value(status,hd(Element)).
loop() ->
receive
diff --git a/test/etap/110-replication-httpc.t b/test/etap/110-replication-httpc.t
index 6f7a4508..529239c5 100755
--- a/test/etap/110-replication-httpc.t
+++ b/test/etap/110-replication-httpc.t
@@ -107,8 +107,8 @@ test_put() ->
method = put
},
{Resp} = couch_rep_httpc:request(Req),
- etap:ok(proplists:get_value(<<"ok">>, Resp), "ok:true on upload"),
- etap:is(<<"test_put">>, proplists:get_value(<<"id">>, Resp), "id is correct").
+ etap:ok(couch_util:get_value(<<"ok">>, Resp), "ok:true on upload"),
+ etap:is(<<"test_put">>, couch_util:get_value(<<"id">>, Resp), "id is correct").
test_qs() ->
Req = #http_db{
diff --git a/test/etap/111-replication-changes-feed.t b/test/etap/111-replication-changes-feed.t
index e92889e9..778b99dd 100755
--- a/test/etap/111-replication-changes-feed.t
+++ b/test/etap/111-replication-changes-feed.t
@@ -153,8 +153,8 @@ test_deleted_conflicts(Type) ->
{ExpectProps} = generate_conflict(),
%% delete the conflict revision
- Id = proplists:get_value(<<"id">>, ExpectProps),
- [Win, {[{<<"rev">>, Lose}]}] = proplists:get_value(<<"changes">>, ExpectProps),
+ Id = couch_util:get_value(<<"id">>, ExpectProps),
+ [Win, {[{<<"rev">>, Lose}]}] = couch_util:get_value(<<"changes">>, ExpectProps),
Doc = couch_doc:from_json_obj({[
{<<"_id">>, Id},
{<<"_rev">>, Lose},
diff --git a/test/etap/121-stats-aggregates.t b/test/etap/121-stats-aggregates.t
index cd6b1430..d678aa9d 100755
--- a/test/etap/121-stats-aggregates.t
+++ b/test/etap/121-stats-aggregates.t
@@ -46,13 +46,13 @@ test_all_empty() ->
etap:is(length(Aggs), 2, "There are only two aggregate types in testing."),
etap:is(
- proplists:get_value(testing, Aggs),
+ couch_util:get_value(testing, Aggs),
{[{stuff, make_agg(<<"yay description">>,
null, null, null, null, null)}]},
"{testing, stuff} is empty at start."
),
etap:is(
- proplists:get_value(number, Aggs),
+ couch_util:get_value(number, Aggs),
{[{'11', make_agg(<<"randomosity">>,
null, null, null, null, null)}]},
"{number, '11'} is empty at start."
diff --git a/test/etap/140-attachment-comp.t b/test/etap/140-attachment-comp.t
index d244b5b0..98d37abc 100755
--- a/test/etap/140-attachment-comp.t
+++ b/test/etap/140-attachment-comp.t
@@ -344,19 +344,19 @@ test_1st_text_att_stub() ->
Json,
[<<"_attachments">>, <<"readme.txt">>]
),
- TextAttLength = proplists:get_value(<<"length">>, TextAttJson),
+ TextAttLength = couch_util:get_value(<<"length">>, TextAttJson),
etap:is(
TextAttLength,
length(test_text_data()),
"1st text attachment stub length matches the uncompressed length"
),
- TextAttEncoding = proplists:get_value(<<"encoding">>, TextAttJson),
+ TextAttEncoding = couch_util:get_value(<<"encoding">>, TextAttJson),
etap:is(
TextAttEncoding,
<<"gzip">>,
"1st text attachment stub has the encoding field set to gzip"
),
- TextAttEncLength = proplists:get_value(<<"encoded_length">>, TextAttJson),
+ TextAttEncLength = couch_util:get_value(<<"encoded_length">>, TextAttJson),
etap:is(
TextAttEncLength,
iolist_size(zlib:gzip(test_text_data())),
@@ -404,19 +404,19 @@ test_1st_png_att_stub() ->
Json,
[<<"_attachments">>, <<"icon.png">>]
),
- PngAttLength = proplists:get_value(<<"length">>, PngAttJson),
+ PngAttLength = couch_util:get_value(<<"length">>, PngAttJson),
etap:is(
PngAttLength,
length(test_png_data()),
"1st png attachment stub length matches the uncompressed length"
),
- PngEncoding = proplists:get_value(<<"encoding">>, PngAttJson),
+ PngEncoding = couch_util:get_value(<<"encoding">>, PngAttJson),
etap:is(
PngEncoding,
undefined,
"1st png attachment stub doesn't have an encoding field"
),
- PngEncLength = proplists:get_value(<<"encoded_length">>, PngAttJson),
+ PngEncLength = couch_util:get_value(<<"encoded_length">>, PngAttJson),
etap:is(
PngEncLength,
undefined,
@@ -531,19 +531,19 @@ test_2nd_text_att_stub() ->
Json,
[<<"_attachments">>, <<"readme.txt">>]
),
- TextAttLength = proplists:get_value(<<"length">>, TextAttJson),
+ TextAttLength = couch_util:get_value(<<"length">>, TextAttJson),
etap:is(
TextAttLength,
length(test_text_data()),
"2nd text attachment stub length matches the uncompressed length"
),
- TextAttEncoding = proplists:get_value(<<"encoding">>, TextAttJson),
+ TextAttEncoding = couch_util:get_value(<<"encoding">>, TextAttJson),
etap:is(
TextAttEncoding,
<<"gzip">>,
"2nd text attachment stub has the encoding field set to gzip"
),
- TextAttEncLength = proplists:get_value(<<"encoded_length">>, TextAttJson),
+ TextAttEncLength = couch_util:get_value(<<"encoded_length">>, TextAttJson),
etap:is(
TextAttEncLength,
iolist_size(zlib:gzip(test_text_data())),
@@ -591,19 +591,19 @@ test_2nd_png_att_stub() ->
Json,
[<<"_attachments">>, <<"icon.png">>]
),
- PngAttLength = proplists:get_value(<<"length">>, PngAttJson),
+ PngAttLength = couch_util:get_value(<<"length">>, PngAttJson),
etap:is(
PngAttLength,
length(test_png_data()),
"2nd png attachment stub length matches the uncompressed length"
),
- PngEncoding = proplists:get_value(<<"encoding">>, PngAttJson),
+ PngEncoding = couch_util:get_value(<<"encoding">>, PngAttJson),
etap:is(
PngEncoding,
undefined,
"2nd png attachment stub doesn't have an encoding field"
),
- PngEncLength = proplists:get_value(<<"encoded_length">>, PngAttJson),
+ PngEncLength = couch_util:get_value(<<"encoded_length">>, PngAttJson),
etap:is(
PngEncLength,
undefined,
@@ -660,20 +660,20 @@ test_get_already_compressed_att_stub(DocUri, AttName) ->
Json,
[<<"_attachments">>, iolist_to_binary(AttName)]
),
- AttLength = proplists:get_value(<<"length">>, AttJson),
+ AttLength = couch_util:get_value(<<"length">>, AttJson),
etap:is(
AttLength,
iolist_size((zlib:gzip(test_text_data()))),
"Already compressed attachment stub length matches the "
"compressed length"
),
- Encoding = proplists:get_value(<<"encoding">>, AttJson),
+ Encoding = couch_util:get_value(<<"encoding">>, AttJson),
etap:is(
Encoding,
<<"gzip">>,
"Already compressed attachment stub has the encoding field set to gzip"
),
- EncLength = proplists:get_value(<<"encoded_length">>, AttJson),
+ EncLength = couch_util:get_value(<<"encoded_length">>, AttJson),
etap:is(
EncLength,
AttLength,
diff --git a/test/view_server/query_server_spec.rb b/test/view_server/query_server_spec.rb
index 1de8e5bc..de1df5c1 100644
--- a/test/view_server/query_server_spec.rb
+++ b/test/view_server/query_server_spec.rb
@@ -139,7 +139,7 @@ functions = {
"js" => %{function(doc){emit("foo",doc.a); emit("bar",doc.a)}},
"erlang" => <<-ERLANG
fun({Doc}) ->
- A = proplists:get_value(<<"a">>, Doc, null),
+ A = couch_util:get_value(<<"a">>, Doc, null),
Emit(<<"foo">>, A),
Emit(<<"bar">>, A)
end.
@@ -153,7 +153,7 @@ functions = {
JS
"erlang" => <<-ERLANG
fun({Doc}) ->
- A = proplists:get_value(<<"a">>, Doc, null),
+ A = couch_util:get_value(<<"a">>, Doc, null),
Emit(<<"baz">>, A)
end.
ERLANG
@@ -175,7 +175,7 @@ functions = {
JS
"erlang" => <<-ERLANG
fun({NewDoc}, _OldDoc, _UserCtx) ->
- case proplists:get_value(<<"bad">>, NewDoc) of
+ case couch_util:get_value(<<"bad">>, NewDoc) of
undefined -> 1;
_ -> {[{forbidden, <<"bad doc">>}]}
end
@@ -191,8 +191,8 @@ functions = {
JS
"erlang" => <<-ERLANG
fun({Doc}, Req) ->
- Title = proplists:get_value(<<"title">>, Doc),
- Body = proplists:get_value(<<"body">>, Doc),
+ Title = couch_util:get_value(<<"title">>, Doc),
+ Body = couch_util:get_value(<<"body">>, Doc),
Resp = <<Title/binary, " - ", Body/binary>>,
{[{<<"body">>, Resp}]}
end.
@@ -208,8 +208,8 @@ functions = {
JS
"erlang" => <<-ERLANG
fun({Doc}, Req) ->
- Title = proplists:get_value(<<"title">>, Doc),
- Body = proplists:get_value(<<"body">>, Doc),
+ Title = couch_util:get_value(<<"title">>, Doc),
+ Body = couch_util:get_value(<<"body">>, Doc),
Resp = <<Title/binary, " - ", Body/binary>>,
{[
{<<"code">>, 200},
@@ -256,9 +256,9 @@ functions = {
"erlang" => <<-ERLANG,
fun(Head, {Req}) ->
Send(<<"first chunk">>),
- Send(proplists:get_value(<<"q">>, Req)),
+ Send(couch_util:get_value(<<"q">>, Req)),
Fun = fun({Row}, _) ->
- Send(proplists:get_value(<<"key">>, Row)),
+ Send(couch_util:get_value(<<"key">>, Row)),
{ok, nil}
end,
{ok, _} = FoldRows(Fun, nil),
@@ -283,7 +283,7 @@ functions = {
fun(Head, Req) ->
Send(<<"bacon">>),
Fun = fun({Row}, _) ->
- Send(proplists:get_value(<<"key">>, Row)),
+ Send(couch_util:get_value(<<"key">>, Row)),
Send(<<"eggs">>),
{ok, nil}
end,
@@ -307,9 +307,9 @@ functions = {
"erlang" => <<-ERLANG,
fun(Head, {Req}) ->
Send(<<"first chunk">>),
- Send(proplists:get_value(<<"q">>, Req)),
+ Send(couch_util:get_value(<<"q">>, Req)),
Fun = fun({Row}, _) ->
- Send(proplists:get_value(<<"key">>, Row)),
+ Send(couch_util:get_value(<<"key">>, Row)),
{ok, nil}
end,
FoldRows(Fun, nil),
@@ -335,13 +335,13 @@ functions = {
"erlang" => <<-ERLANG,
fun(Head, {Req}) ->
Send(<<"first chunk">>),
- Send(proplists:get_value(<<"q">>, Req)),
+ Send(couch_util:get_value(<<"q">>, Req)),
Fun = fun
({Row}, Count) when Count < 2 ->
- Send(proplists:get_value(<<"key">>, Row)),
+ Send(couch_util:get_value(<<"key">>, Row)),
{ok, Count+1};
({Row}, Count) when Count == 2 ->
- Send(proplists:get_value(<<"key">>, Row)),
+ Send(couch_util:get_value(<<"key">>, Row)),
{stop, <<"early tail">>}
end,
{ok, Tail} = FoldRows(Fun, 0),
@@ -380,10 +380,10 @@ functions = {
Send(<<"bacon">>),
Fun = fun
({Row}, Count) when Count < 2 ->
- Send(proplists:get_value(<<"key">>, Row)),
+ Send(couch_util:get_value(<<"key">>, Row)),
{ok, Count+1};
({Row}, Count) when Count == 2 ->
- Send(proplists:get_value(<<"key">>, Row)),
+ Send(couch_util:get_value(<<"key">>, Row)),
{stop, <<"early">>}
end,
{ok, Tail} = FoldRows(Fun, 0),
@@ -408,9 +408,9 @@ functions = {
"erlang" => <<-ERLANG,
fun(Head, {Req}) ->
Send(<<"first chunk">>),
- Send(proplists:get_value(<<"q">>, Req)),
+ Send(couch_util:get_value(<<"q">>, Req)),
Fun = fun({Row}, _) ->
- Send(proplists:get_value(<<"key">>, Row)),
+ Send(couch_util:get_value(<<"key">>, Row)),
{ok, nil}
end,
FoldRows(Fun, nil),
@@ -428,7 +428,7 @@ functions = {
JS
"erlang" => <<-ERLANG,
fun({Doc}, Req) ->
- proplists:get_value(<<"good">>, Doc)
+ couch_util:get_value(<<"good">>, Doc)
end.
ERLANG
},