diff --git a/tests/rules-data/match/head/cclmatch.xml b/tests/rules-data/match/head/cclmatch.xml
new file mode 100644
index 0000000000000000000000000000000000000000..97422c15d1ed4115efe0781940055a7c4714741d
--- /dev/null
+++ b/tests/rules-data/match/head/cclmatch.xml
@@ -0,0 +1,62 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE cesAna SYSTEM "xcesAnaIPI.dtd">
+<cesAna xmlns:xlink="http://www.w3.org/1999/xlink" version="1.0" type="lex disamb">
+<chunkList>
+ <chunk>
+  <sentence>
+   <tok>
+    <orth>Tu</orth>
+    <lex><base>tu</base><ctag>qub</ctag></lex>
+   </tok>
+   <tok>
+    <orth>jest</orth>
+    <lex><base>być</base><ctag>verb</ctag></lex>
+   </tok>
+   <tok>
+    <orth>czarny</orth>
+    <lex><base>czarny</base><ctag>adj</ctag></lex>
+   </tok>
+   <tok>
+    <orth>błyszczący</orth>
+    <lex><base>błyszczeć</base><ctag>adj</ctag></lex>
+   </tok>
+   <tok>
+    <orth>głośnik</orth>
+    <lex><base>głośnik</base><ctag>noun</ctag></lex>
+   </tok>
+   <ns/>
+   <tok>
+    <orth>.</orth>
+    <lex><base>.</base><ctag>interp</ctag></lex>
+   </tok>
+  </sentence>
+  <sentence>
+   <tok>
+    <orth>Tam</orth>
+    <lex><base>tam</base><ctag>qub</ctag></lex>
+   </tok>
+   <tok>
+    <orth>jest</orth>
+    <lex><base>być</base><ctag>verb</ctag></lex>
+   </tok>
+   <tok>
+    <orth>nowa</orth>
+    <lex><base>nowy</base><ctag>adj</ctag></lex>
+   </tok>
+   <tok>
+    <orth>pompa</orth>
+    <lex><base>pompa</base><ctag>noun</ctag></lex>
+   </tok>
+   <tok>
+    <orth>próżniowa</orth>
+    <lex><base>próżniowy</base><ctag>adj</ctag></lex>
+   </tok>
+   <ns/>
+   <tok>
+    <orth>.</orth>
+    <lex><base>.</base><ctag>interp</ctag></lex>
+   </tok>
+  </sentence>
+ </chunk>
+</chunkList>
+</cesAna>
diff --git a/tests/rules-data/match/head/cclmatch1.ccl b/tests/rules-data/match/head/cclmatch1.ccl
new file mode 100644
index 0000000000000000000000000000000000000000..7c7aa4761633262bfa9a1855f841136462579eb9
--- /dev/null
+++ b/tests/rules-data/match/head/cclmatch1.ccl
@@ -0,0 +1,13 @@
+apply
+(
+  match
+  (
+    optional(repeat(equal(class[0], {adj}))),
+    equal(class[0], {noun}),
+    optional(repeat(equal(class[0], {adj})))
+  ),
+  actions
+  (
+    mark(M, M, :2, "NP")
+  )
+)
diff --git a/tests/rules-data/match/head/cclmatch1.out.xml b/tests/rules-data/match/head/cclmatch1.out.xml
new file mode 100644
index 0000000000000000000000000000000000000000..b6871bd699e26dd0d4a778d7283b5abcc88f205a
--- /dev/null
+++ b/tests/rules-data/match/head/cclmatch1.out.xml
@@ -0,0 +1,74 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE cesAna SYSTEM "xcesAnaIPI.dtd">
+<cesAna xmlns:xlink="http://www.w3.org/1999/xlink" version="1.0" type="lex disamb">
+<chunkList>
+ <chunk>
+  <sentence>
+   <tok>
+    <orth>Tu</orth>
+    <lex><base>tu</base><ctag>qub</ctag></lex>
+    <ann chan="NP">0</ann>
+   </tok>
+   <tok>
+    <orth>jest</orth>
+    <lex><base>być</base><ctag>verb</ctag></lex>
+    <ann chan="NP">0</ann>
+   </tok>
+   <tok>
+    <orth>czarny</orth>
+    <lex><base>czarny</base><ctag>adj</ctag></lex>
+    <ann chan="NP">1</ann>
+   </tok>
+   <tok>
+    <orth>błyszczący</orth>
+    <lex><base>błyszczeć</base><ctag>adj</ctag></lex>
+    <ann chan="NP">1</ann>
+   </tok>
+   <tok>
+    <orth>głośnik</orth>
+    <lex><base>głośnik</base><ctag>noun</ctag></lex>
+    <ann chan="NP" head="1">1</ann>
+   </tok>
+   <ns/>
+   <tok>
+    <orth>.</orth>
+    <lex><base>.</base><ctag>interp</ctag></lex>
+    <ann chan="NP">0</ann>
+   </tok>
+  </sentence>
+  <sentence>
+   <tok>
+    <orth>Tam</orth>
+    <lex><base>tam</base><ctag>qub</ctag></lex>
+    <ann chan="NP">0</ann>
+   </tok>
+   <tok>
+    <orth>jest</orth>
+    <lex><base>być</base><ctag>verb</ctag></lex>
+    <ann chan="NP">0</ann>
+   </tok>
+   <tok>
+    <orth>nowa</orth>
+    <lex><base>nowy</base><ctag>adj</ctag></lex>
+    <ann chan="NP">1</ann>
+   </tok>
+   <tok>
+    <orth>pompa</orth>
+    <lex><base>pompa</base><ctag>noun</ctag></lex>
+    <ann chan="NP" head="1">1</ann>
+   </tok>
+   <tok>
+    <orth>próżniowa</orth>
+    <lex><base>próżniowy</base><ctag>adj</ctag></lex>
+    <ann chan="NP">1</ann>
+   </tok>
+   <ns/>
+   <tok>
+    <orth>.</orth>
+    <lex><base>.</base><ctag>interp</ctag></lex>
+    <ann chan="NP">0</ann>
+   </tok>
+  </sentence>
+ </chunk>
+</chunkList>
+</cesAna>
diff --git a/tests/rules-data/match/head/simple.is-the-tagset b/tests/rules-data/match/head/simple.is-the-tagset
new file mode 100644
index 0000000000000000000000000000000000000000..8b137891791fe96927ad78e64b0aad7bded08bdc
--- /dev/null
+++ b/tests/rules-data/match/head/simple.is-the-tagset
@@ -0,0 +1 @@
+