diff --git a/tests/serde-de-references.rs b/tests/serde-de-references.rs
new file mode 100644
index 00000000..88020d9b
--- /dev/null
+++ b/tests/serde-de-references.rs
@@ -0,0 +1,59 @@
+use std::convert::Infallible;
+
+use quick_xml::de::{Deserializer, EntityResolver};
+use quick_xml::events::BytesText;
+use serde::Deserialize;
+
+struct TestResolver;
+impl EntityResolver for TestResolver {
+ type Error = Infallible;
+
+ fn capture(&mut self, _doctype: BytesText) -> Result<(), Self::Error> {
+ Ok(())
+ }
+ fn resolve(&self, entity: &str) -> Option<&str> {
+ match dbg!(entity) {
+ "text" => Some(" "),
+ _ => Some(
+ "
+ &text;
+
+ ",
+ ),
+ }
+ }
+}
+
+#[derive(Debug, PartialEq, Deserialize)]
+struct Root {
+ child1: Child1,
+ child2: (),
+}
+
+#[derive(Debug, PartialEq, Deserialize)]
+struct Child1 {
+ #[serde(rename = "@attribute")]
+ attribute: String,
+
+ #[serde(rename = "$text")]
+ text: String,
+}
+
+#[test]
+fn entities() {
+ let mut de = Deserializer::from_str_with_resolver("&entity;", TestResolver);
+
+ let data = Root::deserialize(&mut de).unwrap();
+
+ assert!(de.is_empty(), "the whole XML document should be consumed");
+ assert_eq!(
+ data,
+ Root {
+ child1: Child1 {
+ attribute: "".to_string(),
+ text: " second text ".to_string(),
+ },
+ child2: (),
+ }
+ );
+}