1%% 2%% %CopyrightBegin% 3%% 4%% Copyright Ericsson AB 2005-2016. All Rights Reserved. 5%% 6%% Licensed under the Apache License, Version 2.0 (the "License"); 7%% you may not use this file except in compliance with the License. 8%% You may obtain a copy of the License at 9%% 10%% http://www.apache.org/licenses/LICENSE-2.0 11%% 12%% Unless required by applicable law or agreed to in writing, software 13%% distributed under the License is distributed on an "AS IS" BASIS, 14%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15%% See the License for the specific language governing permissions and 16%% limitations under the License. 17%% 18%% %CopyrightEnd% 19%% 20-module(otp_5553). 21 22-export([?MODULE/0,test/0,handle_cast/2]). 23 24?MODULE() -> 25 ok. 26 27split_quoted_string([34 | _Rest]) -> %% 34 is '"' 28 ok. 29 30test() -> 31 %% does not start with quote 32 io:format("test: split_quoted_string/1 - 5~n"), 33 try split_quoted_string("foo \"bar\"") of 34 SQS_Res5 -> throw({error, test_case_failed, SQS_Res5}) 35 catch 36 error: does_not_start_with_quote -> ok 37 end, 38 39 %% no ending quote 40 io:format("test: split_quoted_string/1 - 6~n"), 41 try split_quoted_string("\"foo ") of 42 SQS_Res6 -> throw({error, test_case_failed, SQS_Res6}) 43 catch 44 error: no_end_quote -> ok 45 end, 46 47 ok. 48 49test2() -> 50 try split_quoted_string("") of 51 SQS_Res5 -> throw({error, test_case_failed, SQS_Res5}) 52 catch 53 error: does_not_start_with_quote -> ok 54 after 55 ok 56 end, 57 try split_quoted_string("") of 58 SQS_Res6 -> throw({error, test_case_failed, SQS_Res6}) 59 catch 60 error: no_end_quote -> ok 61 after 62 ok 63 end, 64 ok. 65 66-record(state, {connect_all, known = [], synced = [], 67 lockers = [], syncers = [], node_name = node(), 68 the_locker, the_deleter}). 69 70handle_cast({in_sync, Node, IsKnown}, S) -> 71 NewS = cancel_locker(Node, S, get({sync_tag_my, Node})), 72 NKnown = case lists:member(Node, Known = NewS#state.known) of 73 false when IsKnown == true -> 741/0, 75 gen_server:cast({global_name_server, Node}, 76 {in_sync, node(), false}), 77 [Node | Known]; 78 _ -> 79 Known 80 end. 81 82cancel_locker(Node, S, Tag) -> 83 ok. 84