Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/syntax_tools/src/merl.erl
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ compile(Code, Options) when not is_list(Code)->
_ -> compile([Code], Options)
end;
compile(Code, Options0) when is_list(Options0) ->
Forms = [erl_syntax:revert(F) || F <- Code],
Forms = erl_syntax:revert_forms(Code),
Options = [verbose, report_errors, report_warnings, binary | Options0],
compile:noenv_forms(Forms, Options).

Expand Down
37 changes: 28 additions & 9 deletions lib/syntax_tools/test/merl_SUITE.erl
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
%% ``Licensed under the Apache License, Version 2.0 (the "License");
%%
%% %CopyrightBegin%
%%
%% SPDX-License-Identifier: Apache-2.0
%%
%% Copyright Ericsson AB 1996-2025. All Rights Reserved.
%%
%% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License.
%% You may obtain a copy of the License at
%%
Expand All @@ -9,11 +16,9 @@
%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
%% See the License for the specific language governing permissions and
%% limitations under the License.
%%
%% The Initial Developer of the Original Code is Ericsson Utvecklings AB.
%% Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings
%% AB. All Rights Reserved.''
%%
%%
%% %CopyrightEnd%
%%
-module(merl_SUITE).

-include_lib("common_test/include/ct.hrl").
Expand All @@ -25,19 +30,21 @@
-include_lib("eunit/include/eunit.hrl").

%% Test server specific exports
-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1,
-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1,
init_per_group/2,end_per_group/2]).

%% Test cases
-export([merl_smoke_test/1,
transform_parse_error_test/1, otp_15291/1]).
transform_parse_error_test/1, otp_15291/1,
compile_and_load_with_comments/1]).

suite() -> [{ct_hooks,[ts_install_cth]}].

all() ->
[merl_smoke_test,
transform_parse_error_test,
otp_15291].
otp_15291,
compile_and_load_with_comments].

groups() ->
[].
Expand Down Expand Up @@ -112,6 +119,18 @@ otp_15291(_Config) ->
{clause,A1,[{var,A1,'_'}],[],[{atom,A1,ok}]} = C1,
ok.

compile_and_load_with_comments(_Config) ->
?assertMatch({ok, _},
merl:compile_and_load(merl:quote(
~"-module(merl_test_module_1)."))),
?assertMatch({ok, _},
merl:compile_and_load(merl:quote(
~"-module(merl_test_module_2). % comment"))),
?assertMatch({ok, _},
merl:compile_and_load(merl:quote(
~"\n-module(merl_test_module_3).\n% comment"))),
ok.

%% utilities

f(Ts) when is_list(Ts) ->
Expand Down
Loading