From 1f58dc1b6c4fbe06a9e1b897463531ea0186fa92 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 ae3115c8a2..377c766962 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() {} +}