From df84309ab78234c883359f15b7115843d6d56a1d Mon Sep 17 00:00:00 2001 From: "Paulo F. Oliveira" Date: Tue, 21 May 2024 21:35:33 +0100 Subject: [PATCH] Avoid test compilation issues on OTP 27 --- test/examples/fail_no_successive_maps.erl | 10 ++++++++++ test/examples/pass_no_successive_maps_elvis_attr.erl | 10 ++++++++++ test/style_SUITE.erl | 9 +++++++++ 3 files changed, 29 insertions(+) diff --git a/test/examples/fail_no_successive_maps.erl b/test/examples/fail_no_successive_maps.erl index 2e858200..5c0f32cd 100644 --- a/test/examples/fail_no_successive_maps.erl +++ b/test/examples/fail_no_successive_maps.erl @@ -2,12 +2,22 @@ -export([bad/0, good/0]). +-if(?OTP_RELEASE<27). bad() -> M = #{this => is}#{wrong => "and"}, M2 = M#{this := is}#{wrong := "as well"}, M2#{this := is}#{also => wrong}. +-else. +bad() -> + #{}. +-endif. +-if(?OTP_RELEASE<27). good() -> M = #{this => is, good => "and"}, M2 = M#{this := is, good := #{as => well}}, M2#{this := is, also => good}. +-else. +good() -> + #{}. +-endif. diff --git a/test/examples/pass_no_successive_maps_elvis_attr.erl b/test/examples/pass_no_successive_maps_elvis_attr.erl index a0f6b88c..a43719a9 100644 --- a/test/examples/pass_no_successive_maps_elvis_attr.erl +++ b/test/examples/pass_no_successive_maps_elvis_attr.erl @@ -4,12 +4,22 @@ -elvis([{elvis_style, no_successive_maps, disable}]). +-if(?OTP_RELEASE<27). bad() -> M = #{this => is}#{wrong => "and"}, M2 = M#{this := is}#{wrong := "as well"}, M2#{this := is}#{also => wrong}. +-else. +bad() -> + #{}. +-endif. +-if(?OTP_RELEASE<27). good() -> M = #{this => is, good => "and"}, M2 = M#{this := is, good := "as well"}, M2#{this := is, also => good}. +-else. +good() -> + #{}. +-endif. diff --git a/test/style_SUITE.erl b/test/style_SUITE.erl index 8d5148e5..e04cb71f 100644 --- a/test/style_SUITE.erl +++ b/test/style_SUITE.erl @@ -1238,6 +1238,8 @@ verify_no_nested_try_catch(Config) -> Path). -spec verify_no_successive_maps(config()) -> any(). +-if(?OTP_RELEASE < 27). + verify_no_successive_maps(Config) -> Group = proplists:get_value(group, Config, erl_files), Ext = proplists:get_value(test_file_ext, Config, "erl"), @@ -1260,6 +1262,13 @@ verify_no_successive_maps(Config) -> #{ignore => [Module]}, Path). +- else . + +verify_no_successive_maps(_Config) -> + []. + +-endif. + -spec verify_atom_naming_convention(config()) -> any(). verify_atom_naming_convention(Config) -> Group = proplists:get_value(group, Config, erl_files),