From 97fca074ee46033466b2db7e657c52241c652213 Mon Sep 17 00:00:00 2001 From: elbrujohalcon Date: Thu, 24 Oct 2024 18:30:17 +0200 Subject: [PATCH] Adjust tests for OTP26 --- nextroll.dict | 2 ++ test/otp_formatter_SUITE.erl | 11 ++++++++++- test/test_app_SUITE.erl | 5 ++++- test_app/after/src/strings/non_heredoc.erl | 15 +++++++++++++++ test_app/after/src/strings/strings.erl | 12 +----------- test_app/src/strings/non_heredoc.erl | 15 +++++++++++++++ test_app/src/strings/strings.erl | 9 --------- 7 files changed, 47 insertions(+), 22 deletions(-) create mode 100644 test_app/after/src/strings/non_heredoc.erl create mode 100644 test_app/src/strings/non_heredoc.erl diff --git a/nextroll.dict b/nextroll.dict index 580276f..af41619 100644 --- a/nextroll.dict +++ b/nextroll.dict @@ -35,6 +35,8 @@ lay_clauses lay_items old-reliable otp25 +otp26 +otp27 paragraph-format per-file plugin diff --git a/test/otp_formatter_SUITE.erl b/test/otp_formatter_SUITE.erl index 55e9f4f..078d7b0 100644 --- a/test/otp_formatter_SUITE.erl +++ b/test/otp_formatter_SUITE.erl @@ -17,7 +17,16 @@ test_app(_Config) -> case string:to_integer( erlang:system_info(otp_release)) of - {N, _} when N >= 25 -> + {N, _} when N >= 26 -> + {ignore, + ["src/strings/non_heredoc.erl", %% newlines in strings are treated differently since OTP26 + "src/*_ignore.erl", + "src/comments.erl", + "src/ignored_file_config.erl", + "src/dodge_macros.erl", + "src/macros_in_specs.erl", + "src/receive_after.erl"]}; + {25, _} -> {ignore, ["src/*_ignore.erl", "src/comments.erl", diff --git a/test/test_app_SUITE.erl b/test/test_app_SUITE.erl index 0917321..a2ebc1f 100644 --- a/test/test_app_SUITE.erl +++ b/test/test_app_SUITE.erl @@ -50,7 +50,10 @@ init_test_app() -> case string:to_integer( erlang:system_info(otp_release)) of - {N, []} when N >= 25 -> + {N, _} when N >= 26 -> + %% newlines in strings are treated differently since OTP26 + {ignore, ["src/strings/non_heredoc.erl", "src/*_ignore.erl", "src/ignored_file_config.erl"]}; + {25, _} -> {ignore, ["src/*_ignore.erl", "src/ignored_file_config.erl"]}; _ -> {ignore, ["src/*_ignore.erl", "src/ignored_file_config.erl", "src/otp25.erl"]} diff --git a/test_app/after/src/strings/non_heredoc.erl b/test_app/after/src/strings/non_heredoc.erl new file mode 100644 index 0000000..9de6ef5 --- /dev/null +++ b/test_app/after/src/strings/non_heredoc.erl @@ -0,0 +1,15 @@ +-module(strings). + +-export([heredoc/0]). + +-format #{inline_expressions => true}. + +heredoc() -> + {ok, + "" " +This is +a multiline +heredoc but there are +no multiline heredocs in Erlang :'( +" + ""}. diff --git a/test_app/after/src/strings/strings.erl b/test_app/after/src/strings/strings.erl index d08e8fd..027f81a 100644 --- a/test_app/after/src/strings/strings.erl +++ b/test_app/after/src/strings/strings.erl @@ -7,22 +7,12 @@ -attr({with, "a string"}). all() -> - heredoc(), superlong(), repeat(), multiple_calls(), characters(), multiline_with_spaces(). + superlong(), repeat(), multiple_calls(), characters(), multiline_with_spaces(). superlong() -> "This is a super super super super super super super super super super super super super super super super super super super super super super super super super super super super super long string!" "Shouldn't be truncated since truncate_strings => false by default". -heredoc() -> - {ok, - "" " -This is -a multiline -heredoc but there are -no multiline heredocs in Erlang :'( -" - ""}. - repeat() -> ["hello", "there", "hello", "there", "hello", "there" | repeat_more()]. diff --git a/test_app/src/strings/non_heredoc.erl b/test_app/src/strings/non_heredoc.erl new file mode 100644 index 0000000..9de6ef5 --- /dev/null +++ b/test_app/src/strings/non_heredoc.erl @@ -0,0 +1,15 @@ +-module(strings). + +-export([heredoc/0]). + +-format #{inline_expressions => true}. + +heredoc() -> + {ok, + "" " +This is +a multiline +heredoc but there are +no multiline heredocs in Erlang :'( +" + ""}. diff --git a/test_app/src/strings/strings.erl b/test_app/src/strings/strings.erl index 50e2347..87048ee 100644 --- a/test_app/src/strings/strings.erl +++ b/test_app/src/strings/strings.erl @@ -7,7 +7,6 @@ -attr({with, "a string"}). all() -> - heredoc(), superlong(), repeat(), multiple_calls(), @@ -19,14 +18,6 @@ superlong() -> "This is a super super super super super super super super super super super super super super super super super super super super super super super super super super super super super long string!" "Shouldn't be truncated since truncate_strings => false by default". -heredoc() -> -{ok, """ -This is -a multiline -heredoc but there are -no multiline heredocs in Erlang :'( -"""}. - repeat() -> ["hello", "there", "hello", "there",