aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjörn-Egil Dahlberg <[email protected]>2014-03-13 03:01:02 +0100
committerBjörn-Egil Dahlberg <[email protected]>2014-03-17 17:47:36 +0100
commitfdda3a16a4f37e44c496b9fef55b763afa4d77ac (patch)
tree3b6ca5c11a51da3389e3df4a7cbef8e019bdac50
parenta65e0c133314e57adc39a53b48f2cd6ba73b2fe8 (diff)
downloadotp-fdda3a16a4f37e44c496b9fef55b763afa4d77ac.tar.gz
otp-fdda3a16a4f37e44c496b9fef55b763afa4d77ac.tar.bz2
otp-fdda3a16a4f37e44c496b9fef55b763afa4d77ac.zip
stdlib: Test Map key linting
This will change in future release.
-rw-r--r--lib/stdlib/test/erl_lint_SUITE.erl23
1 files changed, 21 insertions, 2 deletions
diff --git a/lib/stdlib/test/erl_lint_SUITE.erl b/lib/stdlib/test/erl_lint_SUITE.erl
index 919489e3d7..673a3cf159 100644
--- a/lib/stdlib/test/erl_lint_SUITE.erl
+++ b/lib/stdlib/test/erl_lint_SUITE.erl
@@ -3389,9 +3389,28 @@ maps(Config) ->
{error_in_illegal_map_construction,
<<"t() -> #{ a := X }.">>,
[],
- {errors,[{1,erl_lint,illegal_map_construction},
+ {errors,[{1,erl_lint,illegal_map_construction},
{1,erl_lint,{unbound_var,'X'}}],
- []}}],
+ []}},
+ {errors_in_map_keys,
+ <<"t(V) -> #{ a => 1,
+ #{a=>V} => 2,
+ #{ \"hi\" => wazzup, hi => ho } => yep,
+ [try a catch _:_ -> b end] => nope,
+ ok => 1.0,
+ [3+3] => nope,
+ 1.0 => yep,
+ {3.0+3} => nope,
+ {yep} => yep,
+ [case a of a -> a end] => nope
+ }.
+ ">>,
+ [],
+ {errors,[{2,erl_lint,{illegal_map_key_variable,'V'}},
+ {4,erl_lint,illegal_map_key},
+ {6,erl_lint,illegal_map_key},
+ {8,erl_lint,illegal_map_key},
+ {10,erl_lint,illegal_map_key}],[]}}],
[] = run(Config, Ts),
ok.