diff --git a/glib-macros/tests/test.rs b/glib-macros/tests/test.rs index 342c9b4f4f4c..b5c791cd14a0 100644 --- a/glib-macros/tests/test.rs +++ b/glib-macros/tests/test.rs @@ -5,7 +5,26 @@ use glib::prelude::*; use glib::subclass::prelude::*; use glib::translate::{FromGlib, ToGlib}; -use glib::{gflags, GBoxed, GEnum}; +use glib::{gflags, GBoxed, GEnum, GErrorDomain}; + +#[test] +fn derive_gerror_domain() { + #[derive(Debug, Eq, PartialEq, Clone, Copy, GErrorDomain)] + #[gerror_domain(name = "TestError")] + enum TestError { + Invalid, + Bad, + Wrong, + } + + // assert_eq!(TestError::Invalid.to_glib(), 0); + // assert_eq!(TestError::Bad.to_glib(), 1); + // assert_eq!(TestError::Wrong.to_glib(), 2); + + let err = glib::Error::new(TestError::Bad, "oh no!"); + assert!(err.is::()); + assert!(matches!(err.kind::(), Some(TestError::Bad))); +} #[test] fn derive_genum() {