diff options
author | Sverker Eriksson <[email protected]> | 2015-05-21 20:01:45 +0200 |
---|---|---|
committer | Sverker Eriksson <[email protected]> | 2015-05-21 20:01:45 +0200 |
commit | 31d663b47a20f2fff9b6a35f91d1ca2b28ce8b9f (patch) | |
tree | 355aa4576280d6c126d242a6ffe2de1e7a6f364e /lib/stdlib/test | |
parent | db7446a0235f5379ed230a51cc1d55475549f36b (diff) | |
parent | c6d38c93b80395ee9dbe65d6dd6751254402ea21 (diff) | |
download | otp-31d663b47a20f2fff9b6a35f91d1ca2b28ce8b9f.tar.gz otp-31d663b47a20f2fff9b6a35f91d1ca2b28ce8b9f.tar.bz2 otp-31d663b47a20f2fff9b6a35f91d1ca2b28ce8b9f.zip |
Merge branch 'sverk/ets-tab2file-syn/OTP-12737'
* sverk/ets-tab2file-syn/OTP-12737:
stdlib: Add 'sync' option to ets:tab2file/3
Diffstat (limited to 'lib/stdlib/test')
-rw-r--r-- | lib/stdlib/test/ets_SUITE.erl | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/lib/stdlib/test/ets_SUITE.erl b/lib/stdlib/test/ets_SUITE.erl index 41bd4af241..a88843bb6e 100644 --- a/lib/stdlib/test/ets_SUITE.erl +++ b/lib/stdlib/test/ets_SUITE.erl @@ -4078,12 +4078,22 @@ tab2file(doc) -> ["Check the ets:tab2file function on an empty " "ets table."]; tab2file(suite) -> []; tab2file(Config) when is_list(Config) -> + ?line FName = filename:join([?config(priv_dir, Config),"tab2file_case"]), + tab2file_do(FName, []), + tab2file_do(FName, [{sync,true}]), + tab2file_do(FName, [{sync,false}]), + {'EXIT',{{badmatch,{error,_}},_}} = (catch tab2file_do(FName, [{sync,yes}])), + {'EXIT',{{badmatch,{error,_}},_}} = (catch tab2file_do(FName, [sync])), + ok. + +tab2file_do(FName, Opts) -> %% Write an empty ets table to a file, read back and check properties. ?line Tab = ets_new(ets_SUITE_foo_tab, [named_table, set, private, {keypos, 2}]), - ?line FName = filename:join([?config(priv_dir, Config),"tab2file_case"]), - ?line ok = ets:tab2file(Tab, FName), - ?line true = ets:delete(Tab), + catch file:delete(FName), + Res = ets:tab2file(Tab, FName, Opts), + true = ets:delete(Tab), + ok = Res, % ?line EtsMem = etsmem(), ?line {ok, Tab2} = ets:file2tab(FName), @@ -4093,6 +4103,7 @@ tab2file(Config) when is_list(Config) -> ?line set = ets:info(Tab2, type), ?line true = ets:delete(Tab2), ?line verify_etsmem(EtsMem). + tab2file2(doc) -> ["Check the ets:tab2file function on a ", "filled set/bag type ets table."]; |