Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Handle column numbers in QLC test suite

  • Loading branch information...
commit ee971e66408ad54f15ae6ce4fb2a881f9f39c98a 1 parent ea969a6
Anthony Ramine authored August 25, 2012

Showing 1 changed file with 35 additions and 42 deletions. Show diff stats Hide diff stats

  1. 77  lib/stdlib/test/qlc_SUITE.erl
77  lib/stdlib/test/qlc_SUITE.erl
@@ -173,10 +173,10 @@ badarg(Config) when is_list(Config) ->
173 173
               q(bar, cache_all, extra).
174 174
        ">>,
175 175
        [],
176  
-       {errors,[{5,?QLC,not_a_query_list_comprehension},
177  
-                {6,?QLC,not_a_query_list_comprehension},
178  
-                {8,?QLC,not_a_query_list_comprehension},
179  
-                {9,?QLC,not_a_query_list_comprehension}],
  176
+       {errors,[{{5,18},?QLC,not_a_query_list_comprehension},
  177
+                {{6,18},?QLC,not_a_query_list_comprehension},
  178
+                {{8,15},?QLC,not_a_query_list_comprehension},
  179
+                {{9,15},?QLC,not_a_query_list_comprehension}],
180 180
         []}}],
181 181
     ?line [] = compile(Config, Ts),
182 182
     ok.
@@ -441,7 +441,7 @@ nomatch(Config) when is_list(Config) ->
441 441
                      end, [{\"ab\"}]).
442 442
         ">>,
443 443
         [],
444  
-        {warnings,[{3,v3_core,nomatch}]}}
  444
+        {warnings,[{{3,38},v3_core,nomatch}]}}
445 445
 
446 446
       ],
447 447
     ?line [] = compile(Config, Ts),
@@ -3211,8 +3211,8 @@ lookup2(Config) when is_list(Config) ->
3211 3211
                  false = lookup_keys(Q)
3212 3212
          end, [{1,b},{2,3}])">>,
3213 3213
         {warnings,[{2,sys_core_fold,nomatch_guard},
3214  
-		   {3,qlc,nomatch_filter},
3215  
-		   {3,sys_core_fold,{eval_failure,badarg}}]}},
  3214
+                   {3,sys_core_fold,{eval_failure,badarg}},
  3215
+                   {{3,48},qlc,nomatch_filter}]}},
3216 3216
 
3217 3217
        <<"etsc(fun(E) ->
3218 3218
                 Q = qlc:q([X || {X} <- ets:table(E), element(1,{X}) =:= 1]),
@@ -5705,7 +5705,7 @@ join_complex(Config) when is_list(Config) ->
5705 5705
                                      ]),
5706 5706
                   qlc:e(Q).">>,
5707 5707
            [],
5708  
-           {warnings,[{3,qlc,too_complex_join}]}},
  5708
+           {warnings,[{{3,26},qlc,too_complex_join}]}},
5709 5709
 
5710 5710
           {two,
5711 5711
            <<"two() ->
@@ -5718,7 +5718,7 @@ join_complex(Config) when is_list(Config) ->
5718 5718
                       Z =:= W],{join,merge}),
5719 5719
                   qlc:e(Q).">>,
5720 5720
            [],
5721  
-           {warnings,[{2,qlc,too_many_joins}]}}
  5721
+           {warnings,[{{2,26},qlc,too_many_joins}]}}
5722 5722
        ],
5723 5723
 
5724 5724
     ?line compile(Config, Ts),
@@ -5960,7 +5960,7 @@ otp_6562(Config) when is_list(Config) ->
5960 5960
                qlc:info(Q).
5961 5961
         ">>,
5962 5962
         [],
5963  
-        {errors,[{2,qlc,binary_generator}],
  5963
+        {errors,[{{2,40},qlc,binary_generator}],
5964 5964
          []}}
5965 5965
        ],
5966 5966
     ?line [] = compile(Config, Bits),
@@ -8007,7 +8007,7 @@ compile_file(Config, Test0, Opts0) ->
8007 8007
                            Test0]),
8008 8008
     Opts = [export_all,return,nowarn_unused_record,{outdir,?privdir}|Opts0],
8009 8009
     ok = file:write_file(File, Test),
8010  
-    case compile:file(File, Opts) of
  8010
+    case compile:file(File, [column|Opts]) of
8011 8011
         {ok, _M, Ws} -> warnings(File, Ws);
8012 8012
         {error, [{File,Es}], []} -> {errors, Es, []};
8013 8013
         {error, [{File,Es}], [{File,Ws}]} -> {error, Es, Ws}
@@ -8017,9 +8017,7 @@ comp_compare(T, T) ->
8017 8017
     true;
8018 8018
 comp_compare(T1, T2_0) ->
8019 8019
     T2 = wskip(T2_0),
8020  
-    T1 =:= T2
8021  
-       %% This clause should eventually be removed. 
8022  
-       orelse ln(T1) =:= T2 orelse T1 =:= ln(T2).
  8020
+    T1 =:= T2.
8023 8021
 
8024 8022
 wskip([]) ->
8025 8023
     [];
@@ -8034,34 +8032,29 @@ wskip([M|L]) ->
8034 8032
 wskip(T) ->
8035 8033
     T.
8036 8034
 
8037  
-%% Replaces locations like {Line,Column} with Line. 
8038  
-ln({warnings,L}) ->
8039  
-    {warnings,ln0(L)};
8040  
-ln({errors,EL,WL}) ->
8041  
-    {errors,ln0(EL),ln0(WL)};
8042  
-ln(L) ->
8043  
-    ln0(L).
8044  
-
8045  
-ln0(L) ->
8046  
-    lists:sort(ln1(L)).
8047  
-
8048  
-ln1([]) ->
8049  
-    [];
8050  
-ln1([{File,Ms}|MsL]) when is_list(File) ->
8051  
-    [{File,ln0(Ms)}|ln1(MsL)];
8052  
-ln1([{{L,_C},Mod,Mess0}|Ms]) ->
8053  
-    Mess = case Mess0 of
8054  
-               {exported_var,V,{Where,{L1,_C1}}} ->
8055  
-                   {exported_var,V,{Where,L1}};
8056  
-               {unsafe_var,V,{Where,{L1,_C1}}} ->
8057  
-                   {unsafe_var,V,{Where,L1}};
8058  
-               %% There are more...
8059  
-               M ->
8060  
-                   M
8061  
-           end,
8062  
-    [{L,Mod,Mess}|ln1(Ms)];
8063  
-ln1([M|Ms]) ->
8064  
-    [M|ln1(Ms)].
  8035
+% sort_warnings({warnings, Ws}) ->
  8036
+%     {warnings, sort_columns(Ws)};
  8037
+% sort_warnings({errors, Es, []}) ->
  8038
+%     {errors, sort_columns(Es), []};
  8039
+% sort_warnings({error, Es, Ws}) ->
  8040
+%     {error, sort_columns(Es), sort_columns(Ws)};
  8041
+% sort_warnings({errors2, Es1, Es2}) ->
  8042
+%     {errors2, sort_columns(Es1), sort_columns(Es2)};
  8043
+% sort_warnings([]) ->
  8044
+%     [].
  8045
+
  8046
+% sort_columns(Ws) ->
  8047
+%     lists:sort(fun ({{_,_}=L1,_,_},{{_,_}=L2,_,_}) when L1 > L2 ->
  8048
+%                        false;
  8049
+%                    ({{L1,_},_,_},{L2,_,_}) when L1 >= L2 ->
  8050
+%                        false;
  8051
+%                    ({L1,_,_},{{L2,_},_,_}) when L1 > L2 ->
  8052
+%                        false;
  8053
+%                    ({L1,_,_},{L2,_,_}) when L1 > L2 ->
  8054
+%                        false;
  8055
+%                    (_,_) ->
  8056
+%                        true
  8057
+%                end, Ws).
8065 8058
 
8066 8059
 %% -> {FileName, Module}; {string(), atom()}
8067 8060
 compile_file_mod(Config) ->

0 notes on commit ee971e6

Please sign in to comment.
Something went wrong with that request. Please try again.