diff options
Diffstat (limited to 'lib/tools')
-rw-r--r-- | lib/tools/doc/src/notes.xml | 40 | ||||
-rw-r--r-- | lib/tools/doc/src/xref.xml | 18 | ||||
-rw-r--r-- | lib/tools/emacs/Makefile | 3 | ||||
-rw-r--r-- | lib/tools/emacs/erlang-skels-old.el | 10 | ||||
-rw-r--r-- | lib/tools/emacs/erlang-skels.el | 429 | ||||
-rw-r--r-- | lib/tools/emacs/erlang.el | 12 | ||||
-rw-r--r-- | lib/tools/emacs/test.erl.indented | 20 | ||||
-rw-r--r-- | lib/tools/emacs/test.erl.orig | 20 | ||||
-rw-r--r-- | lib/tools/src/cover.erl | 12 | ||||
-rw-r--r-- | lib/tools/src/xref_parser.yrl | 17 | ||||
-rw-r--r-- | lib/tools/src/xref_utils.erl | 8 | ||||
-rw-r--r-- | lib/tools/test/xref_SUITE.erl | 9 |
12 files changed, 477 insertions, 121 deletions
diff --git a/lib/tools/doc/src/notes.xml b/lib/tools/doc/src/notes.xml index e6c074cc7d..e7d1ae150c 100644 --- a/lib/tools/doc/src/notes.xml +++ b/lib/tools/doc/src/notes.xml @@ -4,7 +4,7 @@ <chapter> <header> <copyright> - <year>2004</year><year>2009</year> + <year>2004</year><year>2010</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> @@ -13,12 +13,12 @@ compliance with the License. You should have received a copy of the Erlang Public License along with this software. If not, it can be retrieved online at http://www.erlang.org/. - + Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. - + </legalnotice> <title>Tools Release Notes</title> @@ -43,6 +43,40 @@ </list> </section> + <section><title>Improvements and New Features</title> + <list> + <item> + <p> + Add lock profiling tool.</p> + <p> + The Lock profiling tool, lcnt, can make use of the + internal lock statistics when the runtime system is built + with this feature enabled.</p> + <p> + This provides a mechanism to examine potential lock + bottlenecks within the runtime itself.</p> + <p> + - Add erts_debug:lock_counters({copy_save, bool()}). This + option enables or disables statistics saving for + destroyed processes and ets-tables. Enabling this might + consume a lot of memory.</p> + <p> + - Add id-numbering for lock classes which is otherwise + undefined.</p> + <p> + Own Id: OTP-8424</p> + </item> + <item> + <p> + emacs: Moved code skeletons to a separate file and and + added a configurable variable to choose skeleton. Thanks + Dave Peticolas.</p> + <p> + Own Id: OTP-8446</p> + </item> + </list> + </section> + </section> <section><title>Tools 2.6.5</title> diff --git a/lib/tools/doc/src/xref.xml b/lib/tools/doc/src/xref.xml index 407a7392ad..75ffa25311 100644 --- a/lib/tools/doc/src/xref.xml +++ b/lib/tools/doc/src/xref.xml @@ -4,7 +4,7 @@ <erlref> <header> <copyright> - <year>2000</year><year>2009</year> + <year>2000</year><year>2010</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> @@ -13,12 +13,12 @@ compliance with the License. You should have received a copy of the Erlang Public License along with this software. If not, it can be retrieved online at http://www.erlang.org/. - + Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. - + </legalnotice> <title>xref</title> @@ -239,7 +239,7 @@ represented by <item>RegArity ::= RegString | Number | <c>_</c> | <c>-1</c></item> <item>RegAtom ::= RegString | Atom | <c>_</c></item> <item>RegString ::= - a regular expression, as described in the - <c>regexp</c> module, enclosed in double quotes -</item> + <c>re</c> module, enclosed in double quotes -</item> <item>Type ::= <c>Fun</c> | <c>Mod</c> | <c>App</c> | <c>Rel</c></item> <item>Function ::= Atom</item> <item>Application ::= Atom</item> @@ -264,8 +264,7 @@ represented by Assigning a type to a list or tuple of <c>Constant</c> is equivalent to assigning the type to each <c>Constant</c>. </p> - <p> <marker id="regexp"></marker> -<em>Regular expressions</em> are used as a + <p><marker id="regexp"></marker><em>Regular expressions</em> are used as a means to select some of the vertices of a graph. A <c>RegExpr</c> consisting of a <c>RegString</c> and a type - an example is <c>"xref_.*" : Mod</c> - is interpreted as those @@ -1546,8 +1545,11 @@ Evaluates a predefined analysis. </funcs> <section> - <title>See Also</title> - <p>beam_lib(3), digraph(3), digraph_utils(3), regexp(3), + <title>See Also</title><p> + <seealso marker="stdlib:beam_lib">beam_lib(3)</seealso>, + <seealso marker="stdlib:digraph">digraph(3)</seealso>, + <seealso marker="stdlib:digraph_utils">digraph_utils(3)</seealso>, + <seealso marker="stdlib:re">re(3)</seealso>, <seealso marker="xref_chapter">TOOLS User's Guide</seealso></p> </section> </erlref> diff --git a/lib/tools/emacs/Makefile b/lib/tools/emacs/Makefile index 7249263992..0028df247c 100644 --- a/lib/tools/emacs/Makefile +++ b/lib/tools/emacs/Makefile @@ -37,6 +37,9 @@ MAN_FILES= \ tags.3 EMACS_FILES= \ + erlang-skels \ + erlang-skels-old \ + erlang_appwiz \ erlang-start \ erlang-eunit \ erlang diff --git a/lib/tools/emacs/erlang-skels-old.el b/lib/tools/emacs/erlang-skels-old.el index 662590a1f3..b88d7bcc4b 100644 --- a/lib/tools/emacs/erlang-skels-old.el +++ b/lib/tools/emacs/erlang-skels-old.el @@ -433,7 +433,7 @@ Please see the function `tempo-define-template'.") "%% {ok, State, Timeout} |" n "%% ignore |" n "%% {stop, Reason}" n - "%% Description: Initiates the server" n + "%% Description: Initializes the server" n (erlang-skel-separator 2) "init([]) ->" n> "{ok, #state{}}." n @@ -784,7 +784,7 @@ Please see the function `tempo-define-template'.") "%% {ok, State, Timeout} |" n "%% ignore |" n "%% {stop, Reason}" n - "%% Description: Initiates the server" n + "%% Description: Initializes the server" n (erlang-skel-separator 2) "init([]) ->" n> "{ok, #state{}}." n @@ -815,7 +815,7 @@ Please see the function `tempo-define-template'.") "%% Note: This directive should only be used in test suites." n "-compile(export_all)." n n - "-include(\"test_server.hrl\")." n n + "-include_lib(\"test_server/include/test_server.hrl\")." n n (erlang-skel-separator 2) "%% TEST SERVER CALLBACK FUNCTIONS" n @@ -954,7 +954,7 @@ Please see the function `tempo-define-template'.") "%% Note: This directive should only be used in test suites." n "-compile(export_all)." n n - "-include(\"ct.hrl\")." n n + "-include_lib(\"common_test/include/ct.hrl\")." n n (erlang-skel-separator 2) "%% COMMON TEST CALLBACK FUNCTIONS" n @@ -1156,7 +1156,7 @@ Please see the function `tempo-define-template'.") '((erlang-skel-include erlang-skel-large-header) "-compile(export_all)." n n - "-include(\"ct.hrl\")." n n + "-include_lib(\"common_test/include/ct.hrl\")." n n (erlang-skel-separator 2) "%% Function: suite() -> Info" n diff --git a/lib/tools/emacs/erlang-skels.el b/lib/tools/emacs/erlang-skels.el index f92f3f1aae..355b223822 100644 --- a/lib/tools/emacs/erlang-skels.el +++ b/lib/tools/emacs/erlang-skels.el @@ -58,10 +58,12 @@ erlang-skel-lib erlang-skel-header) ("Corba callback" "gen-corba-cb" erlang-skel-corba-callback erlang-skel-header) - ("Erlang test suite TS frontend" "ts-test-suite" + ("Small Common Test suite" "ct-test-suite-s" + erlang-skel-ct-test-suite-s erlang-skel-header) + ("Large Common Test suite" "ct-test-suite-l" + erlang-skel-ct-test-suite-l erlang-skel-header) + ("Erlang TS test suite" "ts-test-suite" erlang-skel-ts-test-suite erlang-skel-header) - ("Erlang test suite CT frontend" "ct-test-suite" - erlang-skel-ct-test-suite erlang-skel-header) ) "*Description of all skeleton templates. Both functions and menu entries will be created. @@ -478,7 +480,7 @@ Please see the function `tempo-define-template'.") (erlang-skel-separator-start 2) "%% @private" n "%% @doc" n - "%% Initiates the server" n + "%% Initializes the server" n "%%" n "%% @spec init(Args) -> {ok, State} |" n "%% {ok, State, Timeout} |" n @@ -888,7 +890,7 @@ Please see the function `tempo-define-template'.") (erlang-skel-separator-start 2) "%% @private" n "%% @doc" n - "%% Initiates the server" n + "%% Initializes the server" n "%%" n "%% @spec init(Args) -> {ok, State} |" n "%% {ok, State, Timeout} |" n @@ -930,15 +932,21 @@ Please see the function `tempo-define-template'.") "%% Note: This directive should only be used in test suites." n "-compile(export_all)." n n - "-include(\"test_server.hrl\")." n n + "-include_lib(\"test_server/include/test_server.hrl\")." n n - "%% Test server callback functions" n (erlang-skel-separator-start 2) + "%% TEST SERVER CALLBACK FUNCTIONS" n + (erlang-skel-separator 2) + n + (erlang-skel-separator-start 2) + "%%" n "%% @doc" n - "%% Config - [tuple()]" n - "%% A list of key/value pairs, holding the test case configuration." n + "%% Initialization before the suite." n "%%" n - "%% Initiation before the whole suite" n + "%% Config0 = Config1 = [tuple()]" n + "%% A list of key/value pairs, holding the test case configuration." n + "%% Reason = term()" n + "%% The reason for skipping the suite." n "%%" n "%% Note: This function is free to add any key/value pairs to the Config" n "%% variable, but should NOT alter/remove any existing entries." n @@ -950,11 +958,10 @@ Please see the function `tempo-define-template'.") (erlang-skel-separator-start 2) "%% @doc" n + "%% Cleanup after the suite." n "%% Config - [tuple()]" n "%% A list of key/value pairs, holding the test case configuration." n "%%" n - "%% Cleanup after the whole suite" n - "%%" n "%% @spec end_per_suite(Config) -> _" n (erlang-skel-separator-end 2) "end_per_suite(_Config) ->" n > @@ -962,12 +969,14 @@ Please see the function `tempo-define-template'.") (erlang-skel-separator-start 2) "%% @doc" n - "%% Case - atom()" n + "%% Initialization before each test case" n + "%%" n + "%% TestCase - atom()" n "%% Name of the test case that is about to be run." n "%% Config - [tuple()]" n "%% A list of key/value pairs, holding the test case configuration." n - "%%" n - "%% Initiation before each test case" n + "%% Reason = term()" n + "%% The reason for skipping the test case." n "%%" n "%% Note: This function is free to add any key/value pairs to the Config" n "%% variable, but should NOT alter/remove any existing entries." n @@ -979,13 +988,13 @@ Please see the function `tempo-define-template'.") (erlang-skel-separator-start 2) "%% @doc" n - "%% Case - atom()" n - "%% Name of the test case that is about to be run." n - "%% Config - [tuple()]" n - "%% A list of key/value pairs, holding the test case configuration." n - "%%" n "%% Cleanup after each test case" n "%%" n + "%% TestCase = atom()" n + "%% Name of the test case that is finished." n + "%% Config = [tuple()]" n + "%% A list of key/value pairs, holding the test case configuration." n + "%%" n "%% @spec end_per_testcase(TestCase, Config) -> _" n (erlang-skel-separator-end 2) "end_per_testcase(_TestCase, _Config) ->" n > @@ -993,64 +1002,247 @@ Please see the function `tempo-define-template'.") (erlang-skel-separator-start 2) "%% @doc" n - "%% Clause - atom() - suite | doc" n - "%% TestCases - [Case]" n - "%% Case - atom()" n - "%% Name of a test case." n - "%%" n + "%% Returns a description of the test suite when" n + "%% Clause == doc, and a test specification (list" n + "%% of the conf and test cases in the suite) when" n + "%% Clause == suite." n "%% Returns a list of all test cases in this test suite" n "%%" n + "%% Clause = doc | suite" n + "%% Indicates expected return value." n + "%% Descr = [string()] | []" n + "%% String that describes the test suite." n + "%% Spec = [TestCase]" n + "%% A test specification." n + "%% TestCase = ConfCase | atom()" n + "%% Configuration case, or the name of a test case function." n + "%% ConfCase = {conf,Init,Spec,End} |" n + "%% {conf,Properties,Init,Spec,End}" n + "%% Init = End = {Mod,Func} | Func" n + "%% Initialization and cleanup function." n + "%% Mod = Func = atom()" n + "%% Properties = [parallel | sequence | Shuffle | {RepeatType,N}]" n + "%% Execution properties of the test cases (may be combined)." n + "%% Shuffle = shuffle | {shuffle,Seed}" n + "%% To get cases executed in random order." n + "%% Seed = {integer(),integer(),integer()}" n + "%% RepeatType = repeat | repeat_until_all_ok | repeat_until_all_fail |" n + "%% repeat_until_any_ok | repeat_until_any_fail" n + "%% To get execution of cases repeated." n + "%% N = integer() | forever" n + "%% Reason = term()" n + "%% The reason for skipping the test suite." n + "%%" n "%% @spec all(Clause) -> TestCases" n (erlang-skel-separator-end 2) "all(doc) ->" n > "[\"Describe the main purpose of this suite\"];" n n - "all(suite) ->" n > - "[]." n n - - "%% Test cases starts here." n + "all(suite) -> " n > + "[a_test_case]." n n + n (erlang-skel-separator-start 2) - "test_case(doc) ->" n > - "[\"Describe the main purpose of test case\"];" n n - "test_case(suite) ->" n > + "%% TEST CASES" n + (erlang-skel-separator 2) + n + (erlang-skel-separator-start 2) + "%% @doc" n + "%% Test case function. Returns a description of the test" n + "%% case (doc), then returns a test specification (suite)," n + "%% or performs the actual test (Config)." n + "%%" n + "%% Arg = doc | suite | Config" n + "%% Indicates expected behaviour and return value." n + "%% Config = [tuple()]" n + "%% A list of key/value pairs, holding the test case configuration." n + "%% Descr = [string()] | []" n + "%% String that describes the test case." n + "%% Spec = [tuple()] | []" n + "%% A test specification, see all/1." n + "%% Reason = term()" n + "%% The reason for skipping the test case." n + "%%" n + "%% @spec TestCase(Arg) -> Descr | Spec | ok | exit() | {skip,Reason}" n + + (erlang-skel-separator-end 2) + "a_test_case(doc) -> " n > + "[\"Describe the main purpose of this test case\"];" n n + "a_test_case(suite) -> " n > "[];" n n - "test_case(Config) when is_list(Config) ->" n > + "a_test_case(Config) when is_list(Config) -> " n > "ok." n ) "*The template of a library module. Please see the function `tempo-define-template'.") -(defvar erlang-skel-ct-test-suite - '((erlang-skel-include erlang-skel-large-header) - "-suite_defaults([{timetrap, {minutes, 10}}])." n n +(defvar erlang-skel-ct-test-suite-s + '((erlang-skel-include erlang-skel-large-header) + "-compile(export_all)." n n - "%% Note: This directive should only be used in test suites." n + "-include_lib(\"common_test/include/ct.hrl\")." n n + + (erlang-skel-separator-start 2) + "%% @spec suite() -> Info" n + "%% Info = [tuple()]" n + (erlang-skel-separator-end 2) + "suite() ->" n > + "[{timetrap,{seconds,30}}]." n n + + (erlang-skel-separator-start 2) + "%% @spec init_per_suite(Config0) ->" n + "%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1}" n + "%% Config0 = Config1 = [tuple()]" n + "%% Reason = term()" n + (erlang-skel-separator-end 2) + "init_per_suite(Config) ->" n > + "Config." n n + + (erlang-skel-separator-start 2) + "%% @spec end_per_suite(Config0) -> void() | {save_config,Config1}" n + "%% Config0 = Config1 = [tuple()]" n + (erlang-skel-separator-end 2) + "end_per_suite(_Config) ->" n > + "ok." n n + + (erlang-skel-separator-start 2) + "%% @spec init_per_group(GroupName, Config0) ->" n + "%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1}" n + "%% GroupName = atom()" n + "%% Config0 = Config1 = [tuple()]" n + "%% Reason = term()" n + (erlang-skel-separator-end 2) + "init_per_group(_GroupName, Config) ->" n > + "Config." n n + + (erlang-skel-separator-start 2) + "%% @spec end_per_group(GroupName, Config0) ->" n + "%% void() | {save_config,Config1}" n + "%% GroupName = atom()" n + "%% Config0 = Config1 = [tuple()]" n + (erlang-skel-separator-end 2) + "end_per_group(_GroupName, _Config) ->" n > + "ok." n n + + (erlang-skel-separator-start 2) + "%% @spec init_per_testcase(TestCase, Config0) ->" n + "%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1}" n + "%% TestCase = atom()" n + "%% Config0 = Config1 = [tuple()]" n + "%% Reason = term()" n + (erlang-skel-separator-end 2) + "init_per_testcase(_TestCase, Config) ->" n > + "Config." n n + + (erlang-skel-separator-start 2) + "%% @spec end_per_testcase(TestCase, Config0) ->" n + "%% void() | {save_config,Config1} | {fail,Reason}" n + "%% TestCase = atom()" n + "%% Config0 = Config1 = [tuple()]" n + "%% Reason = term()" n + (erlang-skel-separator-end 2) + "end_per_testcase(_TestCase, _Config) ->" n > + "ok." n n + + (erlang-skel-separator-start 2) + "%% @spec groups() -> [Group]" n + "%% Group = {GroupName,Properties,GroupsAndTestCases}" n + "%% GroupName = atom()" n + "%% Properties = [parallel | sequence | Shuffle | {RepeatType,N}]" n + "%% GroupsAndTestCases = [Group | {group,GroupName} | TestCase]" n + "%% TestCase = atom()" n + "%% Shuffle = shuffle | {shuffle,{integer(),integer(),integer()}}" n + "%% RepeatType = repeat | repeat_until_all_ok | repeat_until_all_fail |" n + "%% repeat_until_any_ok | repeat_until_any_fail" n + "%% N = integer() | forever" n + (erlang-skel-separator-end 2) + "groups() ->" n > + "[]." n n + + (erlang-skel-separator-start 2) + "%% @spec all() -> GroupsAndTestCases | {skip,Reason}" n + "%% GroupsAndTestCases = [{group,GroupName} | TestCase]" n + "%% GroupName = atom()" n + "%% TestCase = atom()" n + "%% Reason = term()" n + (erlang-skel-separator-end 2) + "all() -> " n > + "[my_test_case]." n n + + (erlang-skel-separator-start 2) + "%% @spec TestCase() -> Info" n + "%% Info = [tuple()]" n + (erlang-skel-separator-end 2) + "my_test_case() -> " n > + "[]." n n + + (erlang-skel-separator-start 2) + "%% @spec TestCase(Config0) ->" n + "%% ok | exit() | {skip,Reason} | {comment,Comment} |" n + "%% {save_config,Config1} | {skip_and_save,Reason,Config1}" n + "%% Config0 = Config1 = [tuple()]" n + "%% Reason = term()" n + "%% Comment = term()" n + (erlang-skel-separator-end 2) + "my_test_case(_Config) -> " n > + "ok." n + ) + "*The template of a library module. +Please see the function `tempo-define-template'.") + + +(defvar erlang-skel-ct-test-suite-l + '((erlang-skel-include erlang-skel-large-header) + "%% Note: This directive should only be used in test suites." n "-compile(export_all)." n n - "-include(\"ct.hrl\")." n n + "-include_lib(\"common_test/include/ct.hrl\")." n n - "%% Test server callback functions" n + (erlang-skel-separator-start 2) + "%% COMMON TEST CALLBACK FUNCTIONS" n + (erlang-skel-separator 2) + n (erlang-skel-separator-start 2) "%% @doc" n - "%% Config - [tuple()]" n - "%% A list of key/value pairs, holding the test case configuration." n + "%% Returns list of tuples to set default properties" n + "%% for the suite." n + "%%" n + "%% Function: suite() -> Info" n + "%%" n + "%% Info = [tuple()]" n + "%% List of key/value pairs." n + "%%" n + "%% Note: The suite/0 function is only meant to be used to return" n + "%% default data values, not perform any other operations." n + "%%" n + "%% @spec suite() -> Info" n + (erlang-skel-separator-end 2) + "suite() ->" n > + "[{timetrap,{minutes,10}}]." n n + + (erlang-skel-separator-start 2) + "%% @doc" n + "%% Initialization before the whole suite" n "%%" n - "%% Initiation before the whole suite" n + "%% Config0 = Config1 = [tuple()]" n + "%% A list of key/value pairs, holding the test case configuration." n + "%% Reason = term()" n + "%% The reason for skipping the suite." n "%%" n "%% Note: This function is free to add any key/value pairs to the Config" n "%% variable, but should NOT alter/remove any existing entries." n "%%" n - "%% @spec init_per_suite(Config) -> Config" n + "%% @spec init_per_suite(Config0) ->" n + "%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1}" n (erlang-skel-separator-end 2) "init_per_suite(Config) ->" n > "Config." n n (erlang-skel-separator-start 2) "%% @doc" n + "%% Cleanup after the whole suite" n + "%%" n "%% Config - [tuple()]" n "%% A list of key/value pairs, holding the test case configuration." n "%%" n - "%% Cleanup after the whole suite" n - "%%" n "%% @spec end_per_suite(Config) -> _" n (erlang-skel-separator-end 2) "end_per_suite(_Config) ->" n > @@ -1058,58 +1250,157 @@ Please see the function `tempo-define-template'.") (erlang-skel-separator-start 2) "%% @doc" n - "%% Case - atom()" n + "%% Initialization before each test case group." n + "%%" n + "%% GroupName = atom()" n + "%% Name of the test case group that is about to run." n + "%% Config0 = Config1 = [tuple()]" n + "%% A list of key/value pairs, holding configuration data for the group." n + "%% Reason = term()" n + "%% The reason for skipping all test cases and subgroups in the group." n + "%%" n + "%% @spec init_per_group(GroupName, Config0) ->" n + "%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1}" n + (erlang-skel-separator-end 2) + "init_per_group(_GroupName, Config) ->" n > + "Config." n n + + (erlang-skel-separator-start 2) + "%% @doc" n + "%% Cleanup after each test case group." n + "%%" n + "%% GroupName = atom()" n + "%% Name of the test case group that is finished." n + "%% Config0 = Config1 = [tuple()]" n + "%% A list of key/value pairs, holding configuration data for the group." n + "%%" n + "%% @spec end_per_group(GroupName, Config0) ->" n + "%% void() | {save_config,Config1}" n + (erlang-skel-separator-end 2) + "end_per_group(_GroupName, _Config) ->" n > + "ok." n n + (erlang-skel-separator-start 2) + "%% @doc" n + "%% Initialization before each test case" n + "%%" n + "%% TestCase - atom()" n "%% Name of the test case that is about to be run." n - "%% Config - [tuple()]" n + "%% Config0 = Config1 = [tuple()]" n "%% A list of key/value pairs, holding the test case configuration." n - "%%" n - "%% Initiation before each test case" n + "%% Reason = term()" n + "%% The reason for skipping the test case." n "%%" n "%% Note: This function is free to add any key/value pairs to the Config" n "%% variable, but should NOT alter/remove any existing entries." n - "%% Initiation before each test case" n "%%" n - "%% @spec init_per_testcase(TestCase, Config) -> Config" n + "%% @spec init_per_testcase(TestCase, Config0) ->" n + "%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1}" n (erlang-skel-separator-end 2) "init_per_testcase(_TestCase, Config) ->" n > "Config." n n (erlang-skel-separator-start 2) "%% @doc" n - "%% Case - atom()" n - "%% Name of the test case that is about to be run." n - "%% Config - [tuple()]" n - "%% A list of key/value pairs, holding the test case configuration." n - "%%" n "%% Cleanup after each test case" n "%%" n - "%% @spec end_per_testcase(TestCase, Config) -> _" n + "%% TestCase - atom()" n + "%% Name of the test case that is finished." n + "%% Config0 = Config1 = [tuple()]" n + "%% A list of key/value pairs, holding the test case configuration." n + "%%" n + "%% @spec end_per_testcase(TestCase, Config0) ->" n + "%% void() | {save_config,Config1} | {fail,Reason}" n (erlang-skel-separator-end 2) "end_per_testcase(_TestCase, _Config) ->" n > - "ok."n n + "ok." n n (erlang-skel-separator-start 2) "%% @doc" n - "%% TestCases - [Case]" n - "%% Case - atom()" n - "%% Name of a test case." n + "%% Returns a list of test case group definitions." n "%%" n - "%% Returns a list of all test cases in this test suite" n + "%% Group = {GroupName,Properties,GroupsAndTestCases}" n + "%% GroupName = atom()" n + "%% The name of the group." n + "%% Properties = [parallel | sequence | Shuffle | {RepeatType,N}]" n + "%% Group properties that may be combined." n + "%% GroupsAndTestCases = [Group | {group,GroupName} | TestCase]" n + "%% TestCase = atom()" n + "%% The name of a test case." n + "%% Shuffle = shuffle | {shuffle,Seed}" n + "%% To get cases executed in random order." n + "%% Seed = {integer(),integer(),integer()}" n + "%% RepeatType = repeat | repeat_until_all_ok | repeat_until_all_fail |" n + "%% repeat_until_any_ok | repeat_until_any_fail" n + "%% To get execution of cases repeated." n + "%% N = integer() | forever" n "%%" n - "%% @spec all() -> TestCases" n + "%% @spec: groups() -> [Group]" n (erlang-skel-separator-end 2) - "all() ->" n > + "groups() ->" n > "[]." n n - "%% Test cases starts here." n (erlang-skel-separator-start 2) - "test_case() ->" n > - "[{doc, \"Describe the main purpose of this test case\"}]." n n - "test_case(Config) when is_list(Config) ->" n > + "%% @doc" n + "%% Returns the list of groups and test cases that" n + "%% are to be executed." n + "%%" n + "%% GroupsAndTestCases = [{group,GroupName} | TestCase]" n + "%% GroupName = atom()" n + "%% Name of a test case group." n + "%% TestCase = atom()" n + "%% Name of a test case." n + "%% Reason = term()" n + "%% The reason for skipping all groups and test cases." n + "%%" n + "%% @spec all() -> GroupsAndTestCases | {skip,Reason}" n + (erlang-skel-separator-end 2) + "all() -> " n > + "[my_test_case]." n n + + n + (erlang-skel-separator-start 2) + "%% TEST CASES" n + (erlang-skel-separator 2) + n + + (erlang-skel-separator-start 2) + "%% @doc " n + "%% Test case info function - returns list of tuples to set" n + "%% properties for the test case." n + "%%" n + "%% Info = [tuple()]" n + "%% List of key/value pairs." n + "%%" n + "%% Note: This function is only meant to be used to return a list of" n + "%% values, not perform any other operations." n + "%%" n + "%% @spec TestCase() -> Info " n + (erlang-skel-separator-end 2) + "my_test_case() -> " n > + "[]." n n + + (erlang-skel-separator 2) + "%% @doc Test case function. (The name of it must be specified in" n + "%% the all/0 list or in a test case group for the test case" n + "%% to be executed)." n + "%%" n + "%% Config0 = Config1 = [tuple()]" n + "%% A list of key/value pairs, holding the test case configuration." n + "%% Reason = term()" n + "%% The reason for skipping the test case." n + "%% Comment = term()" n + "%% A comment about the test case that will be printed in the html log." n + "%%" n + "%% @spec TestCase(Config0) ->" n + "%% ok | exit() | {skip,Reason} | {comment,Comment} |" n + "%% {save_config,Config1} | {skip_and_save,Reason,Config1}" n + (erlang-skel-separator-end 2) + "my_test_case(_Config) -> " n > "ok." n + ) "*The template of a library module. -Please see the function `tempo-define-template'.") + Please see the function `tempo-define-template'.") ;; Skeleton code: diff --git a/lib/tools/emacs/erlang.el b/lib/tools/emacs/erlang.el index da586ee09a..a84f40244d 100644 --- a/lib/tools/emacs/erlang.el +++ b/lib/tools/emacs/erlang.el @@ -2653,7 +2653,8 @@ Value is list (stack token-start token-type in-what)." (cond ((eq (car (car stack)) '\() (erlang-pop stack) (if (and (eq (car (car stack)) 'fun) - (eq (car (car (cdr stack))) '::)) + (or (eq (car (car (last stack))) 'spec) + (eq (car (car (cdr stack))) '::))) ;; -type() ;; Inside fun type def ') closes fun definition (erlang-pop stack))) ((eq (car (car stack)) 'icr) @@ -2874,8 +2875,8 @@ Return nil if inside string, t if in a comment." (+ base erlang-indent-level)) (t (goto-char indent-point) - (cond ((memq (following-char) '(?\( ?{)) - ;; Function application or record. + (cond ((memq (following-char) '(?\( )) + ;; Function application. (+ (erlang-indent-find-preceding-expr) erlang-argument-indent)) ;; Empty line, or end; treat it as the end of @@ -3472,8 +3473,8 @@ Normally used in conjunction with `erlang-beginning-of-clause', e.g.: (erlang-get-function-arrow)))" (and (save-excursion - (re-search-forward "[^-:]*-\\|:" (point-max) t) - (erlang-buffer-substring (- (point) 1) (+ (point) 1))))) + (re-search-forward "->" (point-max) t) + (erlang-buffer-substring (- (point) 2) (+ (point) 1))))) (defun erlang-get-function-arity () "Return the number of arguments of function at point, or nil." @@ -3677,6 +3678,7 @@ non-whitespace characters following the point on the current line." (setq erlang-electric-newline-inhibit nil) (setq erlang-electric-newline-inhibit t) (undo-boundary) + (erlang-indent-line) (end-of-line) (newline) (if (condition-case nil diff --git a/lib/tools/emacs/test.erl.indented b/lib/tools/emacs/test.erl.indented index 1ccced9177..d0ea4c29cf 100644 --- a/lib/tools/emacs/test.erl.indented +++ b/lib/tools/emacs/test.erl.indented @@ -1,20 +1,20 @@ %% -*- erlang -*- %% %% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2009. All Rights Reserved. -%% +%% +%% Copyright Ericsson AB 2009-2010. All Rights Reserved. +%% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in %% compliance with the License. You should have received a copy of the %% Erlang Public License along with this software. If not, it can be %% retrieved online at http://www.erlang.org/. -%% +%% %% Software distributed under the License is distributed on an "AS IS" %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See %% the License for the specific language governing rights and limitations %% under the License. -%% +%% %% %CopyrightEnd% %%%------------------------------------------------------------------- @@ -146,6 +146,8 @@ | {'del_member', name(), pid()}, #state{}) -> {'noreply', #state{}}. +-spec all(fun((T) -> boolean()), List :: [T]) -> + boolean() when is_subtype(T, term()). % (*) -spec get_closest_pid(term()) -> Return :: pid() @@ -349,6 +351,14 @@ indent_basics(X, Y, Z) % AD added clause foo. + +indent_nested() -> + [ + {foo, 2, "string"}, + {bar, 3, "another string"} + ]. + + indent_icr(Z) -> % icr = if case receive %% If if Z >= 0 -> diff --git a/lib/tools/emacs/test.erl.orig b/lib/tools/emacs/test.erl.orig index 9b4203120b..70e97a2e91 100644 --- a/lib/tools/emacs/test.erl.orig +++ b/lib/tools/emacs/test.erl.orig @@ -1,20 +1,20 @@ %% -*- erlang -*- %% %% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2009. All Rights Reserved. -%% +%% +%% Copyright Ericsson AB 2009-2010. All Rights Reserved. +%% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in %% compliance with the License. You should have received a copy of the %% Erlang Public License along with this software. If not, it can be %% retrieved online at http://www.erlang.org/. -%% +%% %% Software distributed under the License is distributed on an "AS IS" %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See %% the License for the specific language governing rights and limitations %% under the License. -%% +%% %% %CopyrightEnd% %%%------------------------------------------------------------------- @@ -146,6 +146,8 @@ t15(),t20(),t21(), t22(),t25()}. | {'del_member', name(), pid()}, #state{}) -> {'noreply', #state{}}. +-spec all(fun((T) -> boolean()), List :: [T]) -> + boolean() when is_subtype(T, term()). % (*) -spec get_closest_pid(term()) -> Return :: pid() @@ -349,6 +351,14 @@ indent_basics(X, Y, Z) % AD added clause foo. + +indent_nested() -> + [ + {foo, 2, "string"}, + {bar, 3, "another string"} + ]. + + indent_icr(Z) -> % icr = if case receive %% If if Z >= 0 -> diff --git a/lib/tools/src/cover.erl b/lib/tools/src/cover.erl index 1a7ebdc69a..6501e05a6e 100644 --- a/lib/tools/src/cover.erl +++ b/lib/tools/src/cover.erl @@ -1,19 +1,19 @@ %% %% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2001-2009. All Rights Reserved. -%% +%% +%% Copyright Ericsson AB 2001-2010. All Rights Reserved. +%% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in %% compliance with the License. You should have received a copy of the %% Erlang Public License along with this software. If not, it can be %% retrieved online at http://www.erlang.org/. -%% +%% %% Software distributed under the License is distributed on an "AS IS" %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See %% the License for the specific language governing rights and limitations %% under the License. -%% +%% %% %CopyrightEnd% %% -module(cover). @@ -689,6 +689,7 @@ main_process_loop(State) -> end, State#main_state.nodes), reload_originals(State#main_state.compiled), + unregister(?SERVER), reply(From, ok); {From, {Request, Module}} -> @@ -869,6 +870,7 @@ remote_process_loop(State) -> {remote,stop} -> reload_originals(State#remote_state.compiled), + unregister(?SERVER), remote_reply(State#remote_state.main_node, ok); get_status -> diff --git a/lib/tools/src/xref_parser.yrl b/lib/tools/src/xref_parser.yrl index e23dce1dec..1279ece061 100644 --- a/lib/tools/src/xref_parser.yrl +++ b/lib/tools/src/xref_parser.yrl @@ -1,19 +1,19 @@ %% %% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2000-2009. All Rights Reserved. -%% +%% +%% Copyright Ericsson AB 2000-2010. All Rights Reserved. +%% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in %% compliance with the License. You should have received a copy of the %% Erlang Public License along with this software. If not, it can be %% retrieved online at http://www.erlang.org/. -%% +%% %% Software distributed under the License is distributed on an "AS IS" %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See %% the License for the specific language governing rights and limitations %% under the License. -%% +%% %% %CopyrightEnd% %% @@ -169,12 +169,11 @@ is_prefix_op('#') -> numeric; is_prefix_op(_) -> false. check_regexp(String) -> - case regexp:parse(String) of + case re:compile(String) of {ok, _Expr} -> {regexpr, String}; - {error, Reason} -> - F = regexp:format_error(Reason), - return_error(0, ["invalid_regexp", String, F]) + {error, {ErrString, Position}} -> + return_error(Position, ["invalid_regexp", String, ErrString]) end. check_regexp_variable('_') -> diff --git a/lib/tools/src/xref_utils.erl b/lib/tools/src/xref_utils.erl index 680b7e8aac..0ef199cec7 100644 --- a/lib/tools/src/xref_utils.erl +++ b/lib/tools/src/xref_utils.erl @@ -640,22 +640,22 @@ neighbours([], G, Fun, VT, L, _V, Vs) -> neighbours(Vs, G, Fun, VT, L). match_list(L, RExpr) -> - {ok, Expr} = regexp:parse(RExpr), + {ok, Expr} = re:compile(RExpr), filter(fun(E) -> match(E, Expr) end, L). match_one(VarL, Con, Col) -> select_each(VarL, fun(E) -> Con =:= element(Col, E) end). match_many(VarL, RExpr, Col) -> - {ok, Expr} = regexp:parse(RExpr), + {ok, Expr} = re:compile(RExpr), select_each(VarL, fun(E) -> match(element(Col, E), Expr) end). match(I, Expr) when is_integer(I) -> S = integer_to_list(I), - {match, 1, length(S)} =:= regexp:first_match(S, Expr); + {match, [{0,length(S)}]} =:= re:run(S, Expr, [{capture, first}]); match(A, Expr) when is_atom(A) -> S = atom_to_list(A), - {match, 1, length(S)} =:= regexp:first_match(S, Expr). + {match, [{0,length(S)}]} =:= re:run(S, Expr, [{capture, first}]). select_each([{Mod,Funs} | L], Pred) -> case filter(Pred, Funs) of diff --git a/lib/tools/test/xref_SUITE.erl b/lib/tools/test/xref_SUITE.erl index b4684140ca..a7855b0bb9 100644 --- a/lib/tools/test/xref_SUITE.erl +++ b/lib/tools/test/xref_SUITE.erl @@ -2306,8 +2306,8 @@ format_error(Conf) when is_list(Conf) -> ?line ok = xref:set_default(s, [{verbose,false}, {warnings, false}]), %% Parse error messages. - ?line 'Invalid regular expression "add(": unterminated \`(\'\n' - = fatom(xref:q(s,'"add("')), + ?line "Invalid regular expression \"add(\"" ++ _ = + fstring(xref:q(s,'"add("')), ?line 'Invalid operator foo\n' = fatom(xref:q(s,'foo E')), ?line 'Invalid wildcard variable \'_Var\' (only \'_\' is allowed)\n' @@ -2705,7 +2705,10 @@ f(S, A) -> flatten(io_lib:format(S, A)). fatom(R) -> - list_to_atom(flatten(xref:format_error(R))). + list_to_atom(fstring(R)). + +fstring(R) -> + flatten(xref:format_error(R)). start(Server) -> ?line case xref:start(Server) of |