From 5fe95cec32ddc92f6a483c24f6f591586ba065f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= Date: Thu, 25 Feb 2016 07:38:39 +0100 Subject: Modernize use of timetraps Either rely on the default 30 minutes timetrap, or set the timeout using the supported methods in common_test. --- lib/compiler/test/record_SUITE.erl | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'lib/compiler/test/record_SUITE.erl') diff --git a/lib/compiler/test/record_SUITE.erl b/lib/compiler/test/record_SUITE.erl index 48a2a9f5df..9f5d09216e 100644 --- a/lib/compiler/test/record_SUITE.erl +++ b/lib/compiler/test/record_SUITE.erl @@ -31,15 +31,14 @@ nested_access/1,coverage/1]). init_per_testcase(_Case, Config) -> - ?line Dog = test_server:timetrap(test_server:minutes(2)), - [{watchdog,Dog}|Config]. + Config. -end_per_testcase(_Case, Config) -> - Dog = ?config(watchdog, Config), - test_server:timetrap_cancel(Dog), +end_per_testcase(_Case, _Config) -> ok. -suite() -> [{ct_hooks,[ts_install_cth]}]. +suite() -> + [{ct_hooks,[ts_install_cth]}, + {timetrap,{minutes,2}}]. all() -> test_lib:recompile(?MODULE), -- cgit v1.2.3 From ca93ccf62e91c55345eb1e67e6ea107ba72e5a1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= Date: Thu, 25 Feb 2016 15:01:29 +0100 Subject: Eliminate use of ?config() macro ?config is ugly and not recommended. Use proplists:get_value/2 instead. --- lib/compiler/test/record_SUITE.erl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/compiler/test/record_SUITE.erl') diff --git a/lib/compiler/test/record_SUITE.erl b/lib/compiler/test/record_SUITE.erl index 9f5d09216e..cc2ea5d20a 100644 --- a/lib/compiler/test/record_SUITE.erl +++ b/lib/compiler/test/record_SUITE.erl @@ -388,7 +388,7 @@ record_test_3(Config) when is_list(Config) -> ok. record_access_in_guards(Config) when is_list(Config) -> - ?line Priv = ?config(priv_dir, Config), + Priv = proplists:get_value(priv_dir, Config), ?line file:set_cwd(test_lib:get_data_dir(Config)), ?line Opts0 = [{outdir,Priv},report_errors|test_lib:opt_opts(?MODULE)], M = record_access_in_guards, -- cgit v1.2.3 From 117daae14c7779a35659589a842af331fe773d6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= Date: Thu, 25 Feb 2016 15:28:25 +0100 Subject: Eliminate use of test_server:fail/0,1 --- lib/compiler/test/record_SUITE.erl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'lib/compiler/test/record_SUITE.erl') diff --git a/lib/compiler/test/record_SUITE.erl b/lib/compiler/test/record_SUITE.erl index cc2ea5d20a..96b6e26ee2 100644 --- a/lib/compiler/test/record_SUITE.erl +++ b/lib/compiler/test/record_SUITE.erl @@ -117,8 +117,8 @@ update_foo_barf(#foo{}=R, A, _B, C, D, E) -> R#barf{a=A,b=A,c=C,d=D,e=E}. --define(TrueGuard(Expr), if Expr -> ok; true -> ?t:fail() end). --define(FalseGuard(Expr), if Expr -> ?t:fail(); true -> ok end). +-define(TrueGuard(Expr), if Expr -> ok; true -> ct:fail(failed) end). +-define(FalseGuard(Expr), if Expr -> ct:fail(failed); true -> ok end). record_test_2(Config) when is_list(Config) -> ?line true = is_record(#foo{}, foo), @@ -514,7 +514,7 @@ once(Test, Record) -> 1 -> ok; N -> io:format("Evaluated ~w times\n", [N]), - ?t:fail() + ct:fail(more_than_once) end, Result. -- cgit v1.2.3 From fc3c64711400be9eae653350213630cb8cb257f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= Date: Thu, 25 Feb 2016 16:12:09 +0100 Subject: Remove ?line macros --- lib/compiler/test/record_SUITE.erl | 370 ++++++++++++++++++------------------- 1 file changed, 185 insertions(+), 185 deletions(-) (limited to 'lib/compiler/test/record_SUITE.erl') diff --git a/lib/compiler/test/record_SUITE.erl b/lib/compiler/test/record_SUITE.erl index 96b6e26ee2..680bd38317 100644 --- a/lib/compiler/test/record_SUITE.erl +++ b/lib/compiler/test/record_SUITE.erl @@ -70,18 +70,18 @@ end_per_group(_GroupName, Config) -> errors(Config) when is_list(Config) -> Foo = #foo{a=1,b=2,c=3,d=4}, - ?line #foo{a=19,b=42,c=3,d=4} = update_foo(Foo, 19, 42), - - ?line {'EXIT',{{badrecord,bar},_}} = (catch update_foo_bar(Foo, 19)), - ?line {'EXIT',{{badrecord,bar},_}} = (catch update_foo_bar(Foo, 19, 35)), - ?line {'EXIT',{{badrecord,bar},_}} = (catch update_foo_bar(Foo, 19, 35, 17)), - ?line {'EXIT',{{badrecord,bar},_}} = (catch update_foo_bar(Foo, 19, 35, 17, 42)), - - ?line {'EXIT',{{badrecord,barf},_}} = (catch update_foo_barf(Foo, 19)), - ?line {'EXIT',{{badrecord,barf},_}} = (catch update_foo_barf(Foo, 19, 35)), - ?line {'EXIT',{{badrecord,barf},_}} = (catch update_foo_barf(Foo, 19, 35, 17)), - ?line {'EXIT',{{badrecord,barf},_}} = (catch update_foo_barf(Foo, 19, 35, 17, 42)), - ?line {'EXIT',{{badrecord,barf},_}} = (catch update_foo_barf(Foo, 19, + #foo{a=19,b=42,c=3,d=4} = update_foo(Foo, 19, 42), + + {'EXIT',{{badrecord,bar},_}} = (catch update_foo_bar(Foo, 19)), + {'EXIT',{{badrecord,bar},_}} = (catch update_foo_bar(Foo, 19, 35)), + {'EXIT',{{badrecord,bar},_}} = (catch update_foo_bar(Foo, 19, 35, 17)), + {'EXIT',{{badrecord,bar},_}} = (catch update_foo_bar(Foo, 19, 35, 17, 42)), + + {'EXIT',{{badrecord,barf},_}} = (catch update_foo_barf(Foo, 19)), + {'EXIT',{{badrecord,barf},_}} = (catch update_foo_barf(Foo, 19, 35)), + {'EXIT',{{badrecord,barf},_}} = (catch update_foo_barf(Foo, 19, 35, 17)), + {'EXIT',{{badrecord,barf},_}} = (catch update_foo_barf(Foo, 19, 35, 17, 42)), + {'EXIT',{{badrecord,barf},_}} = (catch update_foo_barf(Foo, 19, 35, 17, 42, -2)), ok. @@ -121,68 +121,68 @@ update_foo_barf(#foo{}=R, A, _B, C, D, E) -> -define(FalseGuard(Expr), if Expr -> ct:fail(failed); true -> ok end). record_test_2(Config) when is_list(Config) -> - ?line true = is_record(#foo{}, foo), - ?line false = is_record(#foo{}, barf), - ?line false = is_record({foo}, foo), + true = is_record(#foo{}, foo), + false = is_record(#foo{}, barf), + false = is_record({foo}, foo), - ?line true = erlang:is_record(#foo{}, foo), - ?line false = erlang:is_record(#foo{}, barf), - ?line false = erlang:is_record({foo}, foo), + true = erlang:is_record(#foo{}, foo), + false = erlang:is_record(#foo{}, barf), + false = erlang:is_record({foo}, foo), - ?line false = is_record([], foo), - ?line false = is_record(Config, foo), + false = is_record([], foo), + false = is_record(Config, foo), - ?line ?TrueGuard(is_record(#foo{}, foo)), - ?line ?FalseGuard(is_record(#foo{}, barf)), - ?line ?FalseGuard(is_record({foo}, foo)), + ?TrueGuard(is_record(#foo{}, foo)), + ?FalseGuard(is_record(#foo{}, barf)), + ?FalseGuard(is_record({foo}, foo)), - ?line ?TrueGuard(erlang:is_record(#foo{}, foo)), - ?line ?FalseGuard(erlang:is_record(#foo{}, barf)), - ?line ?FalseGuard(erlang:is_record({foo}, foo)), + ?TrueGuard(erlang:is_record(#foo{}, foo)), + ?FalseGuard(erlang:is_record(#foo{}, barf)), + ?FalseGuard(erlang:is_record({foo}, foo)), - ?line ?FalseGuard(is_record([], foo)), - ?line ?FalseGuard(is_record(Config, foo)), + ?FalseGuard(is_record([], foo)), + ?FalseGuard(is_record(Config, foo)), %% 'not is_record/2' to test guard optimization. - ?line ?FalseGuard(not is_record(#foo{}, foo)), - ?line ?TrueGuard(not is_record(#foo{}, barf)), - ?line ?TrueGuard(not is_record({foo}, foo)), + ?FalseGuard(not is_record(#foo{}, foo)), + ?TrueGuard(not is_record(#foo{}, barf)), + ?TrueGuard(not is_record({foo}, foo)), - ?line ?FalseGuard(not erlang:is_record(#foo{}, foo)), - ?line ?TrueGuard(not erlang:is_record(#foo{}, barf)), - ?line ?TrueGuard(not erlang:is_record({foo}, foo)), + ?FalseGuard(not erlang:is_record(#foo{}, foo)), + ?TrueGuard(not erlang:is_record(#foo{}, barf)), + ?TrueGuard(not erlang:is_record({foo}, foo)), Foo = id(#foo{}), - ?line ?FalseGuard(not erlang:is_record(Foo, foo)), - ?line ?TrueGuard(not erlang:is_record(Foo, barf)), + ?FalseGuard(not erlang:is_record(Foo, foo)), + ?TrueGuard(not erlang:is_record(Foo, barf)), - ?line ?TrueGuard(not is_record(Config, foo)), + ?TrueGuard(not is_record(Config, foo)), - ?line ?TrueGuard(not is_record(a, foo)), - ?line ?TrueGuard(not is_record([], foo)), + ?TrueGuard(not is_record(a, foo)), + ?TrueGuard(not is_record([], foo)), %% Pass non-literal first argument. - ?line true = is_record(id(#foo{}), foo), - ?line false = is_record(id(#foo{}), barf), - ?line false = is_record(id({foo}), foo), + true = is_record(id(#foo{}), foo), + false = is_record(id(#foo{}), barf), + false = is_record(id({foo}), foo), - ?line true = erlang:is_record(id(#foo{}), foo), - ?line false = erlang:is_record(id(#foo{}), barf), - ?line false = erlang:is_record(id({foo}), foo), + true = erlang:is_record(id(#foo{}), foo), + false = erlang:is_record(id(#foo{}), barf), + false = erlang:is_record(id({foo}), foo), NoRec1 = id(blurf), NoRec2 = id([]), - ?line ?TrueGuard(not is_record(NoRec1, foo)), - ?line ?TrueGuard(not is_record(NoRec2, foo)), + ?TrueGuard(not is_record(NoRec1, foo)), + ?TrueGuard(not is_record(NoRec2, foo)), %% The optimizer attempts to move expressions to guards, %% but it must not move an is_record/2 call that is not %% allowed in a guard in the first place. - ?line ok = case is_record(id({a}), id(a)) of + ok = case is_record(id({a}), id(a)) of true -> ok; false -> error end, @@ -190,61 +190,61 @@ record_test_2(Config) when is_list(Config) -> %% Force the use of guard bifs by using the 'xor' operation. False = id(false), - ?line ?TrueGuard(is_record(#foo{}, foo) xor False), - ?line ?FalseGuard(is_record(#foo{}, barf) xor False), - ?line ?FalseGuard(is_record({foo}, foo) xor False ), + ?TrueGuard(is_record(#foo{}, foo) xor False), + ?FalseGuard(is_record(#foo{}, barf) xor False), + ?FalseGuard(is_record({foo}, foo) xor False ), - ?line ?TrueGuard(is_record(Foo, foo) xor False), - ?line ?FalseGuard(is_record(Foo, barf) xor False), + ?TrueGuard(is_record(Foo, foo) xor False), + ?FalseGuard(is_record(Foo, barf) xor False), %% Implicit guards by using a list comprehension. List = id([1,#foo{a=2},3,#bar{d=4},5,#foo{a=6},7]), - ?line [#foo{a=2},#foo{a=6}] = [X || X <- List, is_record(X, foo)], - ?line [#bar{d=4}] = [X || X <- List, is_record(X, bar)], - ?line [1,#foo{a=2},3,5,#foo{a=6},7] = + [#foo{a=2},#foo{a=6}] = [X || X <- List, is_record(X, foo)], + [#bar{d=4}] = [X || X <- List, is_record(X, bar)], + [1,#foo{a=2},3,5,#foo{a=6},7] = [X || X <- List, not is_record(X, bar)], - ?line [1,3,5,7] = + [1,3,5,7] = [X || X <- List, ((not is_record(X, bar)) and (not is_record(X, foo)))], - ?line [#foo{a=2},#bar{d=4},#foo{a=6}] = + [#foo{a=2},#bar{d=4},#foo{a=6}] = [X || X <- List, ((is_record(X, bar)) or (is_record(X, foo)))], - ?line [1,3,#bar{d=4}] = + [1,3,#bar{d=4}] = [X || X <- List, ((is_record(X, bar)) or (X < 5))], - ?line MyList = [#foo{a=3},x,[],{a,b}], - ?line [#foo{a=3}] = [X || X <- MyList, is_record(X, foo)], - ?line [x,[],{a,b}] = [X || X <- MyList, not is_record(X, foo)], - ?line [#foo{a=3}] = [X || X <- MyList, begin is_record(X, foo) end], - ?line [x,[],{a,b}] = [X || X <- MyList, begin not is_record(X, foo) end], - ?line [#foo{a=3},x,[],{a,b}] = [X || X <- MyList, is_record(X, foo) or - not is_binary(X)], - ?line [#foo{a=3},x,[],{a,b}] = [X || X <- MyList, not is_record(X, foo) or - not is_binary(X)], - ?line [#foo{a=3}] = [X || X <- MyList, is_record(X, foo) or is_reference(X)], - ?line [x,[],{a,b}] = [X || X <- MyList, not is_record(X, foo) or - is_reference(X)], - ?line [#foo{a=3},x,[],{a,b}] = [X || X <- MyList, - begin is_record(X, foo) or - not is_binary(X) end], - ?line [#foo{a=3},x,[],{a,b}] = [X || X <- MyList, - begin not is_record(X, foo) or - not is_binary(X) end], - ?line [#foo{a=3}] = [X || X <- MyList, - begin is_record(X, foo) or is_reference(X) end], - ?line [x,[],{a,b}] = [X || X <- MyList, - begin not is_record(X, foo) or - is_reference(X) end], + MyList = [#foo{a=3},x,[],{a,b}], + [#foo{a=3}] = [X || X <- MyList, is_record(X, foo)], + [x,[],{a,b}] = [X || X <- MyList, not is_record(X, foo)], + [#foo{a=3}] = [X || X <- MyList, begin is_record(X, foo) end], + [x,[],{a,b}] = [X || X <- MyList, begin not is_record(X, foo) end], + [#foo{a=3},x,[],{a,b}] = [X || X <- MyList, is_record(X, foo) or + not is_binary(X)], + [#foo{a=3},x,[],{a,b}] = [X || X <- MyList, not is_record(X, foo) or + not is_binary(X)], + [#foo{a=3}] = [X || X <- MyList, is_record(X, foo) or is_reference(X)], + [x,[],{a,b}] = [X || X <- MyList, not is_record(X, foo) or + is_reference(X)], + [#foo{a=3},x,[],{a,b}] = [X || X <- MyList, + begin is_record(X, foo) or + not is_binary(X) end], + [#foo{a=3},x,[],{a,b}] = [X || X <- MyList, + begin not is_record(X, foo) or + not is_binary(X) end], + [#foo{a=3}] = [X || X <- MyList, + begin is_record(X, foo) or is_reference(X) end], + [x,[],{a,b}] = [X || X <- MyList, + begin not is_record(X, foo) or + is_reference(X) end], %% Call is_record/2 with illegal arguments. - ?line [] = [X || X <- [], is_record(t, id(X))], - ?line {'EXIT',{badarg,_}} = (catch [X || X <- [1], is_record(t, id(X))]), + [] = [X || X <- [], is_record(t, id(X))], + {'EXIT',{badarg,_}} = (catch [X || X <- [1], is_record(t, id(X))]), %% Update several fields with a string literal. - ?line #barf{} = Barf0 = id(#barf{}), - ?line Barf = update_barf(Barf0), - ?line #barf{a="abc",b=1} = id(Barf), + #barf{} = Barf0 = id(#barf{}), + Barf = update_barf(Barf0), + #barf{a="abc",b=1} = id(Barf), %% Test optimization of is_record/3. false = case id({a,b}) of @@ -257,125 +257,125 @@ record_test_2(Config) when is_list(Config) -> ok. record_test_3(Config) when is_list(Config) -> - ?line true = is_record(#foo{}, foo, 5), - ?line false = is_record(#foo{}, barf, 5), - ?line false = is_record(#foo{}, barf, 6), - ?line false = is_record({foo}, foo, 5), + true = is_record(#foo{}, foo, 5), + false = is_record(#foo{}, barf, 5), + false = is_record(#foo{}, barf, 6), + false = is_record({foo}, foo, 5), - ?line true = erlang:is_record(#foo{}, foo, 5), - ?line false = erlang:is_record(#foo{}, barf, 5), - ?line false = erlang:is_record({foo}, foo, 5), + true = erlang:is_record(#foo{}, foo, 5), + false = erlang:is_record(#foo{}, barf, 5), + false = erlang:is_record({foo}, foo, 5), - ?line false = is_record([], foo), - ?line false = is_record(Config, foo), + false = is_record([], foo), + false = is_record(Config, foo), - ?line ?TrueGuard(is_record(#foo{}, foo, 5)), - ?line ?FalseGuard(is_record(#foo{}, barf, 5)), - ?line ?FalseGuard(is_record(#foo{}, barf, 6)), - ?line ?FalseGuard(is_record({foo}, foo, 5)), + ?TrueGuard(is_record(#foo{}, foo, 5)), + ?FalseGuard(is_record(#foo{}, barf, 5)), + ?FalseGuard(is_record(#foo{}, barf, 6)), + ?FalseGuard(is_record({foo}, foo, 5)), - ?line ?TrueGuard(erlang:is_record(#foo{}, foo, 5)), - ?line ?FalseGuard(erlang:is_record(#foo{}, barf, 5)), - ?line ?FalseGuard(erlang:is_record(#foo{}, barf, 6)), - ?line ?FalseGuard(erlang:is_record({foo}, foo, 5)), + ?TrueGuard(erlang:is_record(#foo{}, foo, 5)), + ?FalseGuard(erlang:is_record(#foo{}, barf, 5)), + ?FalseGuard(erlang:is_record(#foo{}, barf, 6)), + ?FalseGuard(erlang:is_record({foo}, foo, 5)), - ?line ?FalseGuard(is_record([], foo, 5)), - ?line ?FalseGuard(is_record(Config, foo, 5)), + ?FalseGuard(is_record([], foo, 5)), + ?FalseGuard(is_record(Config, foo, 5)), %% 'not is_record/2' to test guard optimization. - ?line ?FalseGuard(not is_record(#foo{}, foo, 5)), - ?line ?TrueGuard(not is_record(#foo{}, barf, 6)), - ?line ?TrueGuard(not is_record({foo}, foo, 5)), + ?FalseGuard(not is_record(#foo{}, foo, 5)), + ?TrueGuard(not is_record(#foo{}, barf, 6)), + ?TrueGuard(not is_record({foo}, foo, 5)), - ?line ?FalseGuard(not erlang:is_record(#foo{}, foo, 5)), - ?line ?TrueGuard(not erlang:is_record(#foo{}, barf, 5)), - ?line ?TrueGuard(not erlang:is_record({foo}, foo, 5)), + ?FalseGuard(not erlang:is_record(#foo{}, foo, 5)), + ?TrueGuard(not erlang:is_record(#foo{}, barf, 5)), + ?TrueGuard(not erlang:is_record({foo}, foo, 5)), Foo = id(#foo{}), - ?line ?FalseGuard(not erlang:is_record(Foo, foo, 5)), - ?line ?TrueGuard(not erlang:is_record(Foo, barf, 6)), + ?FalseGuard(not erlang:is_record(Foo, foo, 5)), + ?TrueGuard(not erlang:is_record(Foo, barf, 6)), - ?line ?TrueGuard(not is_record(Config, foo, 5)), + ?TrueGuard(not is_record(Config, foo, 5)), - ?line ?TrueGuard(not is_record(a, foo, 5)), - ?line ?TrueGuard(not is_record([], foo, 5)), + ?TrueGuard(not is_record(a, foo, 5)), + ?TrueGuard(not is_record([], foo, 5)), %% Pass non-literal first argument. - ?line true = is_record(id(#foo{}), foo, 5), - ?line false = is_record(id(#foo{}), barf, 6), - ?line false = is_record(id({foo}), foo, 5), + true = is_record(id(#foo{}), foo, 5), + false = is_record(id(#foo{}), barf, 6), + false = is_record(id({foo}), foo, 5), - ?line true = erlang:is_record(id(#foo{}), foo, 5), - ?line false = erlang:is_record(id(#foo{}), barf, 6), - ?line false = erlang:is_record(id({foo}), foo, 5), + true = erlang:is_record(id(#foo{}), foo, 5), + false = erlang:is_record(id(#foo{}), barf, 6), + false = erlang:is_record(id({foo}), foo, 5), NoRec1 = id(blurf), NoRec2 = id([]), - ?line ?TrueGuard(not is_record(NoRec1, foo, 5)), - ?line ?TrueGuard(not is_record(NoRec2, foo, 5)), + ?TrueGuard(not is_record(NoRec1, foo, 5)), + ?TrueGuard(not is_record(NoRec2, foo, 5)), %% Force the use of guard bifs by using the 'xor' operation. False = id(false), - ?line ?TrueGuard(is_record(#foo{}, foo, 5) xor False), - ?line ?FalseGuard(is_record(#foo{}, barf, 6) xor False), - ?line ?FalseGuard(is_record({foo}, foo, 5) xor False ), + ?TrueGuard(is_record(#foo{}, foo, 5) xor False), + ?FalseGuard(is_record(#foo{}, barf, 6) xor False), + ?FalseGuard(is_record({foo}, foo, 5) xor False ), - ?line ?TrueGuard(is_record(Foo, foo, 5) xor False), - ?line ?FalseGuard(is_record(Foo, barf, 6) xor False), + ?TrueGuard(is_record(Foo, foo, 5) xor False), + ?FalseGuard(is_record(Foo, barf, 6) xor False), %% Implicit guards by using a list comprehension. List = id([1,#foo{a=2},3,#bar{d=4},5,#foo{a=6},7]), - ?line [#foo{a=2},#foo{a=6}] = [X || X <- List, is_record(X, foo, 5)], - ?line [#bar{d=4}] = [X || X <- List, is_record(X, bar, 5)], - ?line [1,#foo{a=2},3,5,#foo{a=6},7] = + [#foo{a=2},#foo{a=6}] = [X || X <- List, is_record(X, foo, 5)], + [#bar{d=4}] = [X || X <- List, is_record(X, bar, 5)], + [1,#foo{a=2},3,5,#foo{a=6},7] = [X || X <- List, not is_record(X, bar, 5)], - ?line [1,3,5,7] = + [1,3,5,7] = [X || X <- List, ((not is_record(X, bar, 5)) and (not is_record(X, foo, 5)))], - ?line [#foo{a=2},#bar{d=4},#foo{a=6}] = + [#foo{a=2},#bar{d=4},#foo{a=6}] = [X || X <- List, ((is_record(X, bar, 5)) or (is_record(X, foo, 5)))], - ?line [1,3,#bar{d=4}] = + [1,3,#bar{d=4}] = [X || X <- List, ((is_record(X, bar, 5)) or (X < 5))], - ?line MyList = [#foo{a=3},x,[],{a,b}], - ?line [#foo{a=3}] = [X || X <- MyList, is_record(X, foo, 5)], - ?line [x,[],{a,b}] = [X || X <- MyList, not is_record(X, foo, 5)], - ?line [#foo{a=3}] = [X || X <- MyList, begin is_record(X, foo, 5) end], - ?line [x,[],{a,b}] = [X || X <- MyList, begin not is_record(X, foo, 5) end], - ?line [#foo{a=3},x,[],{a,b}] = [X || X <- MyList, is_record(X, foo, 5) or - not is_binary(X)], - ?line [#foo{a=3},x,[],{a,b}] = [X || X <- MyList, not is_record(X, foo, 5) or - not is_binary(X)], - ?line [#foo{a=3}] = [X || X <- MyList, is_record(X, foo) or is_reference(X)], - ?line [x,[],{a,b}] = [X || X <- MyList, not is_record(X, foo) or - is_reference(X)], - ?line [#foo{a=3},x,[],{a,b}] = [X || X <- MyList, - begin is_record(X, foo, 5) or - not is_binary(X) end], - ?line [#foo{a=3},x,[],{a,b}] = [X || X <- MyList, - begin not is_record(X, foo, 5) or - not is_binary(X) end], - ?line [#foo{a=3}] = [X || X <- MyList, - begin is_record(X, foo, 5) or is_reference(X) end], - ?line [x,[],{a,b}] = [X || X <- MyList, - begin not is_record(X, foo, 5) or - is_reference(X) end], + MyList = [#foo{a=3},x,[],{a,b}], + [#foo{a=3}] = [X || X <- MyList, is_record(X, foo, 5)], + [x,[],{a,b}] = [X || X <- MyList, not is_record(X, foo, 5)], + [#foo{a=3}] = [X || X <- MyList, begin is_record(X, foo, 5) end], + [x,[],{a,b}] = [X || X <- MyList, begin not is_record(X, foo, 5) end], + [#foo{a=3},x,[],{a,b}] = [X || X <- MyList, is_record(X, foo, 5) or + not is_binary(X)], + [#foo{a=3},x,[],{a,b}] = [X || X <- MyList, not is_record(X, foo, 5) or + not is_binary(X)], + [#foo{a=3}] = [X || X <- MyList, is_record(X, foo) or is_reference(X)], + [x,[],{a,b}] = [X || X <- MyList, not is_record(X, foo) or + is_reference(X)], + [#foo{a=3},x,[],{a,b}] = [X || X <- MyList, + begin is_record(X, foo, 5) or + not is_binary(X) end], + [#foo{a=3},x,[],{a,b}] = [X || X <- MyList, + begin not is_record(X, foo, 5) or + not is_binary(X) end], + [#foo{a=3}] = [X || X <- MyList, + begin is_record(X, foo, 5) or is_reference(X) end], + [x,[],{a,b}] = [X || X <- MyList, + begin not is_record(X, foo, 5) or + is_reference(X) end], %% Update several fields with a string literal. - ?line #barf{} = Barf0 = id(#barf{}), - ?line Barf = update_barf(Barf0), - ?line #barf{a="abc",b=1} = id(Barf), + #barf{} = Barf0 = id(#barf{}), + Barf = update_barf(Barf0), + #barf{a="abc",b=1} = id(Barf), %% Non-literal arguments. - ?line true = is_record(id(#barf{}), id(barf), id(6)), - ?line false = is_record(id(#barf{}), id(barf), id(42)), - ?line false = is_record(id(#barf{}), id(foo), id(6)), + true = is_record(id(#barf{}), id(barf), id(6)), + false = is_record(id(#barf{}), id(barf), id(42)), + false = is_record(id(#barf{}), id(foo), id(6)), Rec = id(#barf{}), Good = id(barf), @@ -389,14 +389,14 @@ record_test_3(Config) when is_list(Config) -> record_access_in_guards(Config) when is_list(Config) -> Priv = proplists:get_value(priv_dir, Config), - ?line file:set_cwd(test_lib:get_data_dir(Config)), - ?line Opts0 = [{outdir,Priv},report_errors|test_lib:opt_opts(?MODULE)], + file:set_cwd(test_lib:get_data_dir(Config)), + Opts0 = [{outdir,Priv},report_errors|test_lib:opt_opts(?MODULE)], M = record_access_in_guards, Opts = [strict_record_tests|Opts0], - ?line io:format("Options: ~p\n", [Opts]), - ?line {ok,M} = c:c(M, Opts), - ?line ok = M:t(), + io:format("Options: ~p\n", [Opts]), + {ok,M} = c:c(M, Opts), + ok = M:t(), ok. @@ -486,19 +486,19 @@ update_barf(R) -> R#barf{a="abc",b=1}. eval_once(Config) when is_list(Config) -> - ?line once(fun(GetRec) -> + once(fun(GetRec) -> true = erlang:is_record(GetRec(), foo) end, #foo{}), - ?line once(fun(GetRec) -> + once(fun(GetRec) -> (GetRec())#foo{a=1} end, #foo{}), - ?line once(fun(GetRec) -> + once(fun(GetRec) -> (GetRec())#foo{a=1,b=2} end, #foo{}), - ?line once(fun(GetRec) -> + once(fun(GetRec) -> (GetRec())#foo{a=1,b=2,c=3} end, #foo{}), - ?line once(fun(GetRec) -> + once(fun(GetRec) -> (GetRec())#foo{a=1,b=2,c=3,d=4} end, #foo{}), ok. @@ -570,21 +570,21 @@ nested_access(Config) when is_list(Config) -> N0 = #nrec0{}, N1 = #nrec1{}, N2 = #nrec2{}, - ?line <<"nested0">> = N0#nrec0.name, - ?line <<"nested1">> = N1#nrec1.name, - ?line <<"nested2">> = N2#nrec2.name, - ?line <<"nested0">> = N1#nrec1.nrec0#nrec0.name, - ?line <<"nested0">> = N2#nrec2.nrec1#nrec1.nrec0#nrec0.name, - ?line <<"nested1">> = N2#nrec2.nrec1#nrec1.name, - ?line <<"nested0">> = ((N2#nrec2.nrec1)#nrec1.nrec0)#nrec0.name, + <<"nested0">> = N0#nrec0.name, + <<"nested1">> = N1#nrec1.name, + <<"nested2">> = N2#nrec2.name, + <<"nested0">> = N1#nrec1.nrec0#nrec0.name, + <<"nested0">> = N2#nrec2.nrec1#nrec1.nrec0#nrec0.name, + <<"nested1">> = N2#nrec2.nrec1#nrec1.name, + <<"nested0">> = ((N2#nrec2.nrec1)#nrec1.nrec0)#nrec0.name, N1a = N2#nrec2.nrec1#nrec1{name = <<"nested1a">>}, - ?line <<"nested1a">> = N1a#nrec1.name, + <<"nested1a">> = N1a#nrec1.name, N2a = N2#nrec2.nrec1#nrec1.nrec0#nrec0{name = <<"nested0a">>}, N2b = ((N2#nrec2.nrec1)#nrec1.nrec0)#nrec0{name = <<"nested0a">>}, - ?line <<"nested0a">> = N2a#nrec0.name, - ?line N2a = N2b, + <<"nested0a">> = N2a#nrec0.name, + N2a = N2b, ok. -record(rr, {a,b,c}). -- cgit v1.2.3