From e4959e03488cd9df20946dbf1aa8f4b49ea361c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Muska=C5=82a?= Date: Wed, 8 Nov 2023 20:07:17 +0000 Subject: [PATCH] Confitionally run maybe tests Runtimes that don't even have the option, don't support the ?= operator --- test/erlfmt_format_SUITE.erl | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/test/erlfmt_format_SUITE.erl b/test/erlfmt_format_SUITE.erl index acf7d22..f545bfc 100644 --- a/test/erlfmt_format_SUITE.erl +++ b/test/erlfmt_format_SUITE.erl @@ -77,7 +77,8 @@ suite() -> [{timetrap, {seconds, 10}}]. init_per_suite(Config) -> - Config. + Features = get_features(), + [{features, Features} | Config]. end_per_suite(_Config) -> ok. @@ -88,6 +89,11 @@ init_per_group(_GroupName, Config) -> end_per_group(_GroupName, _Config) -> ok. +init_per_testcase(maybe_expression, Config) -> + case has_feature(maybe_expr, Config) of + true -> Config; + false -> {skip, "Maybe feature not present in the runtime system"} + end; init_per_testcase(_TestCase, Config) -> Config. @@ -161,6 +167,15 @@ all() -> comment ]. +get_features() -> + case erlang:function_exported(erl_features, all, 0) of + true -> erl_features:all(); + false -> [] + end. + +has_feature(Feature, Config) -> + lists:member(Feature, proplists:get_value(features, Config)). + %%-------------------------------------------------------------------- %% TEST CASES -define(assertSame(String), ?assertSame(String, 80)).