@@ -1933,6 +1933,44 @@ static void missingHeader4()
19331933 ASSERT_EQUALS (" file0,1,syntax_error,No header in #include\n " , toString (outputList));
19341934}
19351935
1936+ #ifndef _WIN32
1937+ static void missingHeader5 ()
1938+ {
1939+ // this is a directory
1940+ const char code[] = " #include \" /\"\n " ;
1941+ simplecpp::OutputList outputList;
1942+ ASSERT_EQUALS (" " , preprocess (code, &outputList));
1943+ ASSERT_EQUALS (" file0,1,missing_header,Header not found: \" /\"\n " , toString (outputList));
1944+ }
1945+
1946+ static void missingHeader6 ()
1947+ {
1948+ // this is a directory
1949+ const char code[] = " #include \" /usr\"\n " ;
1950+ simplecpp::OutputList outputList;
1951+ ASSERT_EQUALS (" " , preprocess (code, &outputList));
1952+ ASSERT_EQUALS (" file0,1,missing_header,Header not found: \" /usr\"\n " , toString (outputList));
1953+ }
1954+
1955+ static void missingHeader7 ()
1956+ {
1957+ // this is a directory
1958+ const char code[] = " #include </>\n " ;
1959+ simplecpp::OutputList outputList;
1960+ ASSERT_EQUALS (" " , preprocess (code, &outputList));
1961+ ASSERT_EQUALS (" file0,1,missing_header,Header not found: </>\n " , toString (outputList));
1962+ }
1963+
1964+ static void missingHeader8 ()
1965+ {
1966+ // this is a directory
1967+ const char code[] = " #include </usr>\n " ;
1968+ simplecpp::OutputList outputList;
1969+ ASSERT_EQUALS (" " , preprocess (code, &outputList));
1970+ ASSERT_EQUALS (" file0,1,missing_header,Header not found: </usr>\n " , toString (outputList));
1971+ }
1972+ #endif
1973+
19361974static void nestedInclude ()
19371975{
19381976 const char code[] = " #include \" test.h\"\n " ;
@@ -3168,6 +3206,12 @@ int main(int argc, char **argv)
31683206 TEST_CASE (missingHeader2);
31693207 TEST_CASE (missingHeader3);
31703208 TEST_CASE (missingHeader4);
3209+ #ifndef _WIN32
3210+ TEST_CASE (missingHeader5);
3211+ TEST_CASE (missingHeader6);
3212+ TEST_CASE (missingHeader7);
3213+ TEST_CASE (missingHeader8);
3214+ #endif
31713215 TEST_CASE (nestedInclude);
31723216 TEST_CASE (systemInclude);
31733217
0 commit comments