aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans Bolinder <[email protected]>2011-05-13 14:12:36 +0200
committerHans Bolinder <[email protected]>2011-05-13 14:12:36 +0200
commit6f6f9e1a6fd96efd86673855cbdcd316c445c753 (patch)
treec97db2bb992a930fa6056002ed424b70f333ab01
parent0ccc57b1e3772deaf5650077808a38a52b1133b9 (diff)
parentb8f38a71e2c7768b6af6fd877f9bf5ceb0dbbaef (diff)
downloadotp-6f6f9e1a6fd96efd86673855cbdcd316c445c753.tar.gz
otp-6f6f9e1a6fd96efd86673855cbdcd316c445c753.tar.bz2
otp-6f6f9e1a6fd96efd86673855cbdcd316c445c753.zip
Merge branch 'hb/stdlib/dets_tablenames/OTP-9282' into dev
* hb/stdlib/dets_tablenames/OTP-9282: Allow Dets tablenames to be arbitrary terms Conflicts: lib/stdlib/src/dets.erl
-rw-r--r--lib/stdlib/src/dets.erl2
-rw-r--r--lib/stdlib/test/dets_SUITE.erl26
2 files changed, 25 insertions, 3 deletions
diff --git a/lib/stdlib/src/dets.erl b/lib/stdlib/src/dets.erl
index 1b81862940..671b5a9dd4 100644
--- a/lib/stdlib/src/dets.erl
+++ b/lib/stdlib/src/dets.erl
@@ -186,7 +186,7 @@
-opaque object_cont() :: #dets_cont{}.
-type pattern() :: atom() | tuple().
-opaque select_cont() :: #dets_cont{}.
--type tab_name() :: atom() | reference().
+-type tab_name() :: term().
-type type() :: 'bag' | 'duplicate_bag' | 'set'.
-type version() :: 8 | 9 | 'default'.
diff --git a/lib/stdlib/test/dets_SUITE.erl b/lib/stdlib/test/dets_SUITE.erl
index 9fcc9e6aaf..698070368f 100644
--- a/lib/stdlib/test/dets_SUITE.erl
+++ b/lib/stdlib/test/dets_SUITE.erl
@@ -53,7 +53,7 @@
simultaneous_open/1, insert_new/1, repair_continuation/1,
otp_5487/1, otp_6206/1, otp_6359/1, otp_4738/1, otp_7146/1,
otp_8070/1, otp_8856/1, otp_8898/1, otp_8899/1, otp_8903/1,
- otp_8923/1]).
+ otp_8923/1, otp_9282/1]).
-export([dets_dirty_loop/0]).
@@ -112,7 +112,7 @@ all() ->
many_clients, otp_4906, otp_5402, simultaneous_open,
insert_new, repair_continuation, otp_5487, otp_6206,
otp_6359, otp_4738, otp_7146, otp_8070, otp_8856, otp_8898,
- otp_8899, otp_8903, otp_8923]
+ otp_8899, otp_8903, otp_8923, otp_9282]
end.
groups() ->
@@ -3857,6 +3857,28 @@ otp_8923(Config) when is_list(Config) ->
file:delete(File),
ok.
+otp_9282(doc) ->
+ ["OTP-9282. The name of a table can be an arbitrary term"];
+otp_9282(suite) ->
+ [];
+otp_9282(Config) when is_list(Config) ->
+ some_calls(make_ref(), Config),
+ some_calls({a,typical,name}, Config),
+ some_calls(fun() -> a_funny_name end, Config),
+ ok.
+
+some_calls(Tab, Config) ->
+ File = filename(ref, Config),
+ ?line {ok,T} = dets:open_file(Tab, [{file,File}]),
+ ?line T = Tab,
+ ?line false = dets:info(T, safe_fixed),
+ ?line File = dets:info(T, filename),
+ ?line ok = dets:insert(Tab, [{3,0}]),
+ ?line [{3,0}] = dets:lookup(Tab, 3),
+ ?line [{3,0}] = dets:traverse(Tab, fun(X) -> {continue, X} end),
+ ?line ok = dets:close(T),
+ file:delete(File).
+
%%
%% Parts common to several test cases
%%