From 8e2ec999394c77741241ef1a12728b11195961c8 Mon Sep 17 00:00:00 2001 From: Lukas Larsson Date: Mon, 21 Mar 2016 17:53:26 +0100 Subject: erts: Document erlang:match_spec_test/3 OTP-13501 --- erts/doc/src/erlang.xml | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) (limited to 'erts/doc/src/erlang.xml') diff --git a/erts/doc/src/erlang.xml b/erts/doc/src/erlang.xml index d6fe585c8d..fde04504c8 100644 --- a/erts/doc/src/erlang.xml +++ b/erts/doc/src/erlang.xml @@ -2612,6 +2612,48 @@ os_prompt% + + + Test that a match specification works + +

+ This function is a utility to test a match_spec used in calls to + ets:select/2 and + erlang:trace_pattern/3. + The function both tests MatchSpec for "syntactic" correctness and + runs the match_spec against the object. If the match_spec contains + errors, the tuple {error, Errors} is returned where Errors is a list + of natural language descriptions of what was wrong with the match_spec. +

+

+ If the Type is table the object to match + against should be a tuple. The function then returns + {ok,Result,[],Warnings} where Result is what would have been the + result in a real ets:select/2 call or false if the match_spec does + not match the object tuple. +

+ +

+ If Type is trace the object to match + against should be a list. The function returns + {ok, Result, Flags, Warnings} where Result is true if a trace + message should be emitted, false if a trace message should not + be emitted or the message term to be appended to the trace message. + Flags is a list containing all the trace flags that will be enabled, + at the moment this is only return_trace. +

+ +

+ This is a useful debugging and test tool, especially when writing complicated + match specifications. +

+

+ See also + ets:test_ms/2. +

+
+
+ Returns the largest of two terms. -- cgit v1.2.3