From fdc5a56ee3083fe98e950bf18336f1c8c209f6e9 Mon Sep 17 00:00:00 2001 From: Erich Gubler Date: Mon, 21 Oct 2024 21:11:54 -0400 Subject: [PATCH] WIP: add tests for `enable` extension parsing --- .../front/wgsl/parse/directive/enable_extension.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/naga/src/front/wgsl/parse/directive/enable_extension.rs b/naga/src/front/wgsl/parse/directive/enable_extension.rs index 147ec0b5e0..b1502bba19 100644 --- a/naga/src/front/wgsl/parse/directive/enable_extension.rs +++ b/naga/src/front/wgsl/parse/directive/enable_extension.rs @@ -76,10 +76,12 @@ impl EnableExtension { /// A variant of [`EnableExtension::Implemented`]. #[derive(Clone, Copy, Debug, Hash, Eq, PartialEq)] +#[cfg_attr(test, derive(strum::EnumIter))] pub enum ImplementedEnableExtension {} /// A variant of [`EnableExtension::Unimplemented`]. #[derive(Clone, Copy, Debug, Hash, Eq, PartialEq)] +#[cfg_attr(test, derive(strum::EnumIter))] pub enum UnimplementedEnableExtension { /// Enables `f16`/`half` primitive support in all shader languages. /// @@ -110,3 +112,15 @@ impl UnimplementedEnableExtension { } } } +#[cfg(test)] +mod test { + use strum::IntoEnumIterator as _; + + use super::ImplementedEnableExtension; + + fn valid() { + for extension in ImplementedEnableExtension::iter() {} + } + + fn unimplemented() {} +}