diff --git a/t-switch-dir-to-symlink/Makefile b/t-switch-dir-to-symlink/Makefile
index 0988703..ca8dcb6 100644
--- a/t-switch-dir-to-symlink/Makefile
+++ b/t-switch-dir-to-symlink/Makefile
@@ -1,10 +1,27 @@
 TESTS_DEB := pkg-dir-real pkg-dir-symlink-0 pkg-dir-symlink-1 \
-             pkg-dir-conffile-0 pkg-dir-conffile-1
+             pkg-dir-conffile-0 pkg-dir-conffile-1 \
+             pkg-dir-foo-0 pkg-dir-foo-1 pkg-dir-foobar-1
 
 include ../Test.mk
 
 test-case:
 	# Cannot switch a directory containing conffiles
+	$(DPKG_INSTALL) pkg-dir-foo-0.deb
+	test -d /test-path
+	$(DPKG_INSTALL) pkg-dir-foobar-1.deb
+	test -d /test-path
+	test -d /test-pathdir
+	! $(DPKG_INSTALL) pkg-dir-foo-1.deb
+	! test -h /test-path
+	! test -h /test-pathdir
+	test -d /test-path
+	test -f /test-path/file-conf
+	test -d /test-pathdir
+	test -f /test-pathdir/file-conf
+	$(DPKG_PURGE) pkg-dir-foo
+	$(DPKG_PURGE) pkg-dir-foobar
+
+	# Cannot switch a directory containing conffiles
 	$(DPKG_INSTALL) pkg-dir-conffile-0.deb
 	test -d /test-path
 	! $(DPKG_INSTALL) pkg-dir-conffile-1.deb
@@ -43,6 +60,8 @@ test-case:
 	! test -e /test-path
 
 test-clean:
+	$(DPKG_PURGE) pkg-dir-foo
+	$(DPKG_PURGE) pkg-dir-foobar
 	$(DPKG_PURGE) pkg-dir-conffile
 	$(DPKG_PURGE) pkg-dir-symlink
 	$(DPKG_PURGE) pkg-dir-real
diff --git a/t-switch-dir-to-symlink/pkg-dir-foo-0/DEBIAN/conffiles b/t-switch-dir-to-symlink/pkg-dir-foo-0/DEBIAN/conffiles
new file mode 100644
index 0000000..296ef19
--- /dev/null
+++ b/t-switch-dir-to-symlink/pkg-dir-foo-0/DEBIAN/conffiles
@@ -0,0 +1 @@
+/test-path/file-conf
diff --git a/t-switch-dir-to-symlink/pkg-dir-foo-0/DEBIAN/control b/t-switch-dir-to-symlink/pkg-dir-foo-0/DEBIAN/control
new file mode 100644
index 0000000..a52bf4b
--- /dev/null
+++ b/t-switch-dir-to-symlink/pkg-dir-foo-0/DEBIAN/control
@@ -0,0 +1,7 @@
+Package: pkg-dir-foo
+Version: 0
+Section: test
+Priority: extra
+Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org>
+Architecture: all
+Description: test package - package with dir to be switched to symlink
diff --git a/t-switch-dir-to-symlink/pkg-dir-foo-0/test-path/file-conf b/t-switch-dir-to-symlink/pkg-dir-foo-0/test-path/file-conf
new file mode 100644
index 0000000..e69de29
diff --git a/t-switch-dir-to-symlink/pkg-dir-foo-1/DEBIAN/control b/t-switch-dir-to-symlink/pkg-dir-foo-1/DEBIAN/control
new file mode 100644
index 0000000..390c27e
--- /dev/null
+++ b/t-switch-dir-to-symlink/pkg-dir-foo-1/DEBIAN/control
@@ -0,0 +1,8 @@
+Package: pkg-dir-foo
+Version: 1
+Section: test
+Priority: extra
+Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org>
+Architecture: all
+Depends: pkg-dir-foobar (>= 1)
+Description: test package - package switching dir to symlink
diff --git a/t-switch-dir-to-symlink/pkg-dir-foo-1/DEBIAN/postinst b/t-switch-dir-to-symlink/pkg-dir-foo-1/DEBIAN/postinst
new file mode 100755
index 0000000..a4d98f1
--- /dev/null
+++ b/t-switch-dir-to-symlink/pkg-dir-foo-1/DEBIAN/postinst
@@ -0,0 +1,5 @@
+#!/bin/sh
+set -e
+if dpkg-maintscript-helper supports dir_to_symlink; then
+    dpkg-maintscript-helper dir_to_symlink /test-path /test-pathdir 0 -- "$@"
+fi
diff --git a/t-switch-dir-to-symlink/pkg-dir-foo-1/DEBIAN/postrm b/t-switch-dir-to-symlink/pkg-dir-foo-1/DEBIAN/postrm
new file mode 100755
index 0000000..a4d98f1
--- /dev/null
+++ b/t-switch-dir-to-symlink/pkg-dir-foo-1/DEBIAN/postrm
@@ -0,0 +1,5 @@
+#!/bin/sh
+set -e
+if dpkg-maintscript-helper supports dir_to_symlink; then
+    dpkg-maintscript-helper dir_to_symlink /test-path /test-pathdir 0 -- "$@"
+fi
diff --git a/t-switch-dir-to-symlink/pkg-dir-foo-1/DEBIAN/preinst b/t-switch-dir-to-symlink/pkg-dir-foo-1/DEBIAN/preinst
new file mode 100755
index 0000000..a4d98f1
--- /dev/null
+++ b/t-switch-dir-to-symlink/pkg-dir-foo-1/DEBIAN/preinst
@@ -0,0 +1,5 @@
+#!/bin/sh
+set -e
+if dpkg-maintscript-helper supports dir_to_symlink; then
+    dpkg-maintscript-helper dir_to_symlink /test-path /test-pathdir 0 -- "$@"
+fi
diff --git a/t-switch-dir-to-symlink/pkg-dir-foo-1/test-path b/t-switch-dir-to-symlink/pkg-dir-foo-1/test-path
new file mode 120000
index 0000000..8938394
--- /dev/null
+++ b/t-switch-dir-to-symlink/pkg-dir-foo-1/test-path
@@ -0,0 +1 @@
+test-pathdir
\ No newline at end of file
diff --git a/t-switch-dir-to-symlink/pkg-dir-foobar-1/DEBIAN/conffiles b/t-switch-dir-to-symlink/pkg-dir-foobar-1/DEBIAN/conffiles
new file mode 100644
index 0000000..9faacce
--- /dev/null
+++ b/t-switch-dir-to-symlink/pkg-dir-foobar-1/DEBIAN/conffiles
@@ -0,0 +1 @@
+/test-pathdir/file-conf
diff --git a/t-switch-dir-to-symlink/pkg-dir-foobar-1/DEBIAN/control b/t-switch-dir-to-symlink/pkg-dir-foobar-1/DEBIAN/control
new file mode 100644
index 0000000..db7a847
--- /dev/null
+++ b/t-switch-dir-to-symlink/pkg-dir-foobar-1/DEBIAN/control
@@ -0,0 +1,7 @@
+Package: pkg-dir-foobar
+Version: 1
+Section: test
+Priority: extra
+Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org>
+Architecture: all
+Description: test package - package with dir to be switched to symlink
diff --git a/t-switch-dir-to-symlink/pkg-dir-foobar-1/test-pathdir/file-conf b/t-switch-dir-to-symlink/pkg-dir-foobar-1/test-pathdir/file-conf
new file mode 100644
index 0000000..e69de29
