diff options
author | Dylan Baker <dylan@pnwbakers.com> | 2022-12-21 09:55:26 -0800 |
---|---|---|
committer | Eli Schwartz <eschwartz93@gmail.com> | 2023-02-15 22:58:50 -0500 |
commit | 3589815eb9dd8402deabedcd4492f33e04870c56 (patch) | |
tree | a039f474889d4be7b639dfacabb5d0b1163d80e4 /test cases | |
parent | a3098fbfa32ae4ff654f0da45bcfcd9aa7893b5f (diff) | |
download | meson-3589815eb9dd8402deabedcd4492f33e04870c56.zip meson-3589815eb9dd8402deabedcd4492f33e04870c56.tar.gz meson-3589815eb9dd8402deabedcd4492f33e04870c56.tar.bz2 |
interpreter: add a feature.enable_auto_if
It's always been strange to me we don't have an opposite method of the
`disable_auto_if` method, but I've been pressed to find a case where we
_need_ one, because `disable_auto_if` can't be logically contorted to
work. I finally found the case where they're not equivalent: when you
don't want to convert to a boolean:
```meson
f = get_option('feat').disable_auto_if(not foo)
g = get_option('feat').enable_auto_if(foo)
dep1 = dependency('foo', required : f)
dep2 = dependency('foo', required : g)
```
Diffstat (limited to 'test cases')
-rw-r--r-- | test cases/common/192 feature option/meson.build | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/test cases/common/192 feature option/meson.build b/test cases/common/192 feature option/meson.build index b5e26fa..d6de744 100644 --- a/test cases/common/192 feature option/meson.build +++ b/test cases/common/192 feature option/meson.build @@ -17,6 +17,8 @@ assert(required_opt.allowed(), 'Should be enabled option') assert(required_opt.require(true, error_message: 'xyz').enabled(), 'Should be enabled option') assert(required_opt.disable_auto_if(true).enabled(), 'Should be enabled option') assert(required_opt.disable_auto_if(false).enabled(), 'Should be enabled option') +assert(required_opt.enable_auto_if(true).enabled(), 'Should be enabled option') +assert(required_opt.enable_auto_if(false).enabled(), 'Should be enabled option') assert(not optional_opt.enabled(), 'Should be auto option') assert(not optional_opt.disabled(), 'Should be auto option') @@ -26,6 +28,8 @@ assert(optional_opt.require(true).auto(), 'Should be auto option') assert(optional_opt.require(false, error_message: 'xyz').disabled(), 'Should be disabled auto option') assert(optional_opt.disable_auto_if(true).disabled(), 'Should be disabled auto option') assert(optional_opt.disable_auto_if(false).auto(), 'Should be auto option') +assert(optional_opt.enable_auto_if(true).enabled(), 'Should be disabled auto option') +assert(optional_opt.enable_auto_if(false).auto(), 'Should be auto option') assert(not disabled_opt.enabled(), 'Should be disabled option') assert(disabled_opt.disabled(), 'Should be disabled option') @@ -35,6 +39,8 @@ assert(disabled_opt.require(true).disabled(), 'Should be disabled option') assert(disabled_opt.require(false, error_message: 'xyz').disabled(), 'Should be disabled option') assert(disabled_opt.disable_auto_if(true).disabled(), 'Should be disabled option') assert(disabled_opt.disable_auto_if(false).disabled(), 'Should be disabled option') +assert(disabled_opt.enable_auto_if(true).disabled(), 'Should be disabled option') +assert(disabled_opt.enable_auto_if(false).disabled(), 'Should be disabled option') dep = dependency('threads', required : required_opt) assert(dep.found(), 'Should find required "threads" dep') |