diff --git a/testing/templates/cycle1.html b/testing/templates/cycle1.html
new file mode 100644
index 00000000..f48ce0cb
--- /dev/null
+++ b/testing/templates/cycle1.html
@@ -0,0 +1 @@
+{% extends "cycle1.html" %}
diff --git a/testing/templates/cycle2.html b/testing/templates/cycle2.html
new file mode 100644
index 00000000..323560b9
--- /dev/null
+++ b/testing/templates/cycle2.html
@@ -0,0 +1 @@
+{% extends "cycle2.html" %}
diff --git a/testing/tests/ui/cycle.rs b/testing/tests/ui/cycle.rs
new file mode 100644
index 00000000..b6f7f614
--- /dev/null
+++ b/testing/tests/ui/cycle.rs
@@ -0,0 +1,8 @@
+use askama::Template;
+
+#[derive(Template)]
+#[template(path = "cycle2.html")]
+struct Cycle;
+
+fn main() {
+}
diff --git a/testing/tests/ui/cycle.stderr b/testing/tests/ui/cycle.stderr
new file mode 100644
index 00000000..df765cef
--- /dev/null
+++ b/testing/tests/ui/cycle.stderr
@@ -0,0 +1,9 @@
+error: cyclic dependency in graph [
+ "\"$WORKSPACE/target/tests/trybuild/askama_testing/templates/cycle2.html/" --> \"$WORKSPACE/target/tests/trybuild/askama_testing/templates/cycle2.html/"",
+ ]
+ --> tests/ui/cycle.rs:3:10
+ |
+3 | #[derive(Template)]
+ | ^^^^^^^^
+ |
+ = note: this error originates in the derive macro `Template` (in Nightly builds, run with -Z macro-backtrace for more info)
diff --git a/testing/tests/ui/cycle2.rs b/testing/tests/ui/cycle2.rs
new file mode 100644
index 00000000..9fbae96a
--- /dev/null
+++ b/testing/tests/ui/cycle2.rs
@@ -0,0 +1,8 @@
+use askama::Template;
+
+#[derive(Template)]
+#[template(path = "cycle1.html")]
+struct Cycle;
+
+fn main() {
+}
diff --git a/testing/tests/ui/cycle2.stderr b/testing/tests/ui/cycle2.stderr
new file mode 100644
index 00000000..682f8502
--- /dev/null
+++ b/testing/tests/ui/cycle2.stderr
@@ -0,0 +1,9 @@
+error: cyclic dependency in graph [
+ "\"$WORKSPACE/target/tests/trybuild/askama_testing/templates/cycle1.html/" --> \"$WORKSPACE/target/tests/trybuild/askama_testing/templates/cycle1.html/"",
+ ]
+ --> tests/ui/cycle2.rs:3:10
+ |
+3 | #[derive(Template)]
+ | ^^^^^^^^
+ |
+ = note: this error originates in the derive macro `Template` (in Nightly builds, run with -Z macro-backtrace for more info)