diff --git a/tests/datarule.cpp b/tests/datarule.cpp
index 871f2a548c11410f198babda3ea1074268164ba2..de6c6d39534bf80048a673d2a71a16effe3d61d9 100644
--- a/tests/datarule.cpp
+++ b/tests/datarule.cpp
@@ -150,9 +150,15 @@ void test_one_rule_item_actual(const rule_compare_test& c)
 	if (!chunk) {
 		BOOST_ERROR("Empty chunk loaded");
 	}
-	Corpus2::XcesReader xr(tagset, c.output_corpus.string());
-	xr.set_option("loose");
-	boost::shared_ptr<Corpus2::Chunk> expected = xr.get_next_chunk();
+	boost::shared_ptr<Corpus2::TokenReader> reader;
+	std::string ofn = c.output_corpus.filename();
+	if (ofn.find("ccl") != ofn.npos) {
+		reader = Corpus2::TokenReader::create_path_reader("ccl", tagset, c.output_corpus.string());
+	} else {
+		reader = Corpus2::TokenReader::create_path_reader("xces", tagset, c.output_corpus.string());
+	}
+	reader->set_option("loose");
+	boost::shared_ptr<Corpus2::Chunk> expected = reader->get_next_chunk();
 	BOOST_REQUIRE_EQUAL(chunk->sentences().size(), expected->sentences().size());
 	Wccl::Parser parser(tagset);
 	std::string rf = c.rule_file.string();