aboutsummaryrefslogtreecommitdiffstats
path: root/lib/stdlib/test
AgeCommit message (Collapse)Author
2015-12-15stdlib: Add a comment about is_subtype(_, _) constraintsHans Bolinder
2015-12-15stdlib: Remove undocumented function specification syntaxHans Bolinder
The syntax -spec/callback F/A :: FunctionType; has been removed. No deprecation was deemed necessary.
2015-12-11stdlib tests: Replace 'random' with 'rand'Björn Gustavsson
2015-12-07Merge branch 'maint'Björn Gustavsson
* maint: Correct rand:export_seed/0 when there is no prior seed
2015-12-07Merge branch 'bjorn/stdlib/rand-export_seed/OTP-13162' into maintBjörn Gustavsson
* bjorn/stdlib/rand-export_seed/OTP-13162: Correct rand:export_seed/0 when there is no prior seed
2015-12-07Correct rand:export_seed/0 when there is no prior seedBjörn Gustavsson
According to the documentation, rand:export_seed/0 should return 'undefined' if the seed has not been intialized. However, it will create and return a seed. That means that the following code will not work as expected: case rand:export_seed() of undefined -> rand:seen({1,2,3}); _ -> ok end, rand:uniform(Range)
2015-12-07Merge branch 'maint'Hans Bolinder
* maint: doc: Fix some minor issues in Types and Function Specifications erts: Remove CDATA from The Abstract Format document erts: Correct the types section in The Abstract Format document stdlib: Correct pretty-printing of map types stdlib: Pretty-print constraints as 'V :: T' Conflicts: erts/doc/src/absform.xml
2015-12-07stdlib: Correct pretty-printing of map typesHans Bolinder
Add parentheses around annotated type union elements in map pair types. The bug was introduced in Erlang/OTP 18.0.
2015-12-04Merge branch 'maint'Björn Gustavsson
* maint: Extend erl_lint:format_error/1 to handle bittype mismatches erl_lint_SUITE: Add smoke test of format_error/1
2015-12-03Extend erl_lint:format_error/1 to handle bittype mismatchesBjörn Gustavsson
erl_lint:format_error/1 would crash with a function error if conflicting types were given. That was most easily noticed in the shell: Eshell V7.0.3 (abort with ^G) 1> <<0/integer-binary>>. *** ERROR: Shell process terminated! *** Noticed-by: Aleksei Magusev
2015-12-03erl_lint_SUITE: Add smoke test of format_error/1Björn Gustavsson
The test suite depended on the compiler to call erl_lint:format_error/1 to ensure that format_error/1 was covered. Unfortunately, though, if format_error/1 crashed the compiler would catch the exception so that the test suite would not notice it. Add a smoke test of format_error/1 that will crash if there is any problem with erl_lint:format_error/1.
2015-11-27Forbid bytes modifier for unsized part of binary generatorAleksei Magusev
This type modifier was missed in 90efeaf21147505b1e8207822e606027f94183cc.
2015-11-19Merge branch 'bjorn/cleanup'Björn Gustavsson
* bjorn/cleanup: epp: Only flatten the original filename epp: Modernize the internal data structures epp: Eliminate the Type argument from expand_macros/5 epp: Refactor user_predef/2 to share more code epp: Refactor scan_define() epp: Remove vestigial support for packages epp_SUITE: Improve coverage of epp epp_SUITE: Extend smoke and cover test of format_error/1 epp_SUITE: Add test of -extends()
2015-11-17epp: Refactor scan_define()Björn Gustavsson
Refactor scan_define() in order to share more between macros without any arguments and macros with arguments.
2015-11-17epp_SUITE: Improve coverage of eppBjörn Gustavsson
2015-11-17epp_SUITE: Extend smoke and cover test of format_error/1Björn Gustavsson
30a4adb7 added smoke and cover test of format_error/1, but did not catch calls that went through check/2.
2015-11-16epp_SUITE: Add test of -extends()Björn Gustavsson
2015-11-13stdlib: Fix bug in binary:split for empty binarySverker Eriksson
Bug introduced om master branch at b93e9b611056828a and reported in ERL-43.
2015-10-29epp_SUITE: Avoid hard-coding list of macros more than onceBjörn Gustavsson
2015-10-29epp_SUITE: Add smoke and coverage test of format_error/1Björn Gustavsson
2015-10-19Use full list of bindings when matching on map keysJosé Valim
Prior to this patch, the following code would not eval: X = key, (fun(#{X := value}) -> true end)(#{X => value}) That's because the key evaluation was using the new list of bindings introduced on every anonymous fun. Since keys only match on values defined prior to the pattern and do not introduce any new binding, we must use the full and original list of binding.
2015-10-08Take out automatic insertion of 'undefined' from typed record fieldsKostis Sagonas
Background ----------- In record fields with a type declaration but without an initializer, the Erlang parser inserted automatically the singleton type 'undefined' to the list of declared types, if that value was not present there. I.e. the record declaration: -record(rec, {f1 :: float(), f2 = 42 :: integer(), f3 :: some_mod:some_typ()}). was translated by the parser to: -record(rec, {f1 :: float() | 'undefined', f2 = 42 :: integer(), f3 :: some_mod:some_typ() | 'undefined'}). The rationale for this was that creation of a "dummy" #rec{} record should not result in a warning from dialyzer that e.g. the implicit initialization of the #rec.f1 field violates its type declaration. Problems --------- This seemingly innocent action has some unforeseen consequences. For starters, there is no way for programmers to declare that e.g. only floats make sense for the f1 field of #rec{} records when there is no `obvious' default initializer for this field. (This also affects tools like PropEr that use these declarations produced by the Erlang parser to generate random instances of records for testing purposes.) It also means that dialyzer does not warn if e.g. an is_atom/1 test or something more exotic like an atom_to_list/1 call is performed on the value of the f1 field. Similarly, there is no way to extend dialyzer to warn if it finds record constructions where f1 is not initialized to some float. Last but not least, it is semantically problematic when the type of the field is an opaque type: creating a union of an opaque and a structured type is very problematic for analysis because it fundamentally breaks the opacity of the term at that point. Change ------- To solve these problems the parser will not automatically insert the 'undefined' value anymore; instead the user has the option to choose the places where this value makes sense (for the field) and where it does not and insert the | 'undefined' there manually. Consequences of this change ---------------------------- This change means that dialyzer will issue a warning for all places where records with uninitialized fields are created and those fields have a declared type that is incompatible with 'undefined' (e.g. float()). This warning can be suppressed easily by adding | 'undefined' to the type of this field. This also adds documentation that the user really intends to create records where this field is uninitialized.
2015-09-18Merge branch 'maint'Dan Gudmundsson
* maint: stdlib: Fix leaking files after error_logger:logfile(close)
2015-09-17stdlib: Fix leaking files after error_logger:logfile(close)Dan Gudmundsson
Introduced when changing state from tuple to record.
2015-09-15stdlib: Remove deprecated functions in erl_parse and erl_scanHans Bolinder
The recently added module erl_anno can no longer handle negative line numbers.
2015-09-14Merge branch 'maint'Anders Svensson
2015-09-14Merge branch 'bjorn/cuddle-with-tests' into maintBjörn Gustavsson
* bjorn/cuddle-with-tests: (23 commits) rand_SUITE: Speed up basic_stats/1 base64_SUITE: Speed up roundtrip/1 lists_SUITE: Test lists:concat/2 lists_SUITE: Test lists:split/2 lists_SUITE: Add a test case for lists:prefix/2 lists_SUITE: Add hof/1 to test all high-order functions lists_SUITE: Add test for lists:takewhile/1 lists_SUITE: Run test cases in each group in parallel lists_SUITE: Test lists:keyreplace/4 lists_SUITE: Extend flatten/1 test to also test flatlength/1 lists_SUITE: Correct test of lists:flatten/2 id_transform_SUITE: Modernize test suite io_proto_SUITE: Speed up determination of default shell io_proto_SUITE: Refactor up rtnode() and friends gen_event_SUITE: Remove unnecessary sleep calls proc_lib: Improve coverage for crash/1 proc_lib_SUITE: Eliminate compiler warnings io_SUITE: Add coverage/1 to completely cover io_lib_pretty io_SUITE: Extend coverage of code for testing printable chars io_SUITE: Speed up test for bad +pc option ...
2015-09-11rand_SUITE: Speed up basic_stats/1Björn Gustavsson
Refactor basic_stats/1 into three separate test cases that can be run in parallel.
2015-09-11base64_SUITE: Speed up roundtrip/1Björn Gustavsson
Refactor roundtrip/1 into 4 test cases that can be run in parallel. Assuming that there are 4 cores available, the group of 4 test cases will run at roughly one fourth of the time for the original test case.
2015-09-11lists_SUITE: Test lists:concat/2Björn Gustavsson
2015-09-11lists_SUITE: Test lists:split/2Björn Gustavsson
2015-09-11lists_SUITE: Add a test case for lists:prefix/2Björn Gustavsson
2015-09-11lists_SUITE: Add hof/1 to test all high-order functionsBjörn Gustavsson
2015-09-11lists_SUITE: Add test for lists:takewhile/1Björn Gustavsson
2015-09-11lists_SUITE: Run test cases in each group in parallelBjörn Gustavsson
On my computer, this will shave off more than one second of the runnning time and about 4 seconds when cover is being run.
2015-09-11lists_SUITE: Test lists:keyreplace/4Björn Gustavsson
2015-09-11lists_SUITE: Extend flatten/1 test to also test flatlength/1Björn Gustavsson
2015-09-11lists_SUITE: Correct test of lists:flatten/2Björn Gustavsson
The test that was supposed to call lists:flatten/2 called lists:flatten/1!
2015-09-11id_transform_SUITE: Modernize test suiteBjörn Gustavsson
Remove handling of Clearcase; remove ?line macros.
2015-09-11io_proto_SUITE: Speed up determination of default shellBjörn Gustavsson
Use getline_pred action that fails fast if the shell is not the oldshell, to avoid having to wait for the timeout.
2015-09-11io_proto_SUITE: Refactor up rtnode() and friendsBjörn Gustavsson
Introduce a new {getline_pred, Fun, Msg} action that is useful in itself, but can also be used to share more code for {getline, Match} and {getline_re, Match}. Also get rid of the ?line macros in rtnode() so that we can somewhat reduce the ridculous indentation level.
2015-09-11gen_event_SUITE: Remove unnecessary sleep callsBjörn Gustavsson
The calls to test_server:sleep/1 are unnecessary as the swapping of handlers happens in a single process. Even though the {swap_info,...} message is sent asynchronously, the gen_event:which_handlers/1 call will not have a chance to execute until the handlers have been swapped.
2015-09-11proc_lib: Improve coverage for crash/1Björn Gustavsson
First refactor the entire test case using helper functions to facilitate further maintenance. Then test that proc_lib can handle that the process dictionary has been erased (that will cover more code in proc_lib). We can also shave off 2 seconds of the execution time by testing the 'shutdown' exit reasons at beginning of the test case instead of doing it at the end.
2015-09-11proc_lib_SUITE: Eliminate compiler warningsBjörn Gustavsson
Use error/1 instead of forcing a badmatch.
2015-09-11io_SUITE: Add coverage/1 to completely cover io_lib_prettyBjörn Gustavsson
2015-09-11io_SUITE: Extend coverage of code for testing printable charsBjörn Gustavsson
2015-09-11io_SUITE: Speed up test for bad +pc optionBjörn Gustavsson
Move the test for a bad +pc option to its own test case for cleanliness. Use the os:cmd/1 function to avoid the annyoying 30 seconds time-out in test_server:start_node/3.
2015-09-11io_SUITE: Add test for printing of mapsBjörn Gustavsson
2015-09-10Merge branch 'maint'Björn Gustavsson
* maint: stdlib: Fix bug with unicode detection in re
2015-09-10Merge branch 'howleysv/stdlib/compiled-unicode/OTP-12977' into maintBjörn Gustavsson
* howleysv/stdlib/compiled-unicode/OTP-12977: stdlib: Fix bug with unicode detection in re