2 * Copyright (C) 2010 Joel Rosdahl
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the Free
6 * Software Foundation; either version 3 of the License, or (at your option)
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14 * You should have received a copy of the GNU General Public License along with
15 * this program; if not, write to the Free Software Foundation, Inc., 51
16 * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 * This file contains tests for the compopt_* functions.
25 #include "test/framework.h"
29 TEST(option_table_should_be_sorted)
31 bool compopt_verify_sortedness();
32 CHECK(compopt_verify_sortedness());
35 TEST(dash_I_affects_cpp)
37 CHECK(compopt_affects_cpp("-I"));
38 CHECK(!compopt_affects_cpp("-Ifoo"));
43 CHECK(compopt_short(compopt_affects_cpp, "-Ifoo"));
44 CHECK(!compopt_short(compopt_affects_cpp, "-include"));
47 TEST(dash_V_doesnt_affect_cpp)
49 CHECK(!compopt_affects_cpp("-V"));
52 TEST(dash_doesnexist_doesnt_affect_cpp)
54 CHECK(!compopt_affects_cpp("-doesntexist"));
57 TEST(dash_MM_too_hard)
59 CHECK(compopt_too_hard("-MM"));
62 TEST(dash_MD_not_too_hard)
64 CHECK(!compopt_too_hard("-MD"));
67 TEST(dash_doesnexist_not_too_hard)
69 CHECK(!compopt_too_hard("-doesntexist"));
72 TEST(dash_Xpreprocessor_too_hard_for_direct_mode)
74 CHECK(compopt_too_hard_for_direct_mode("-Xpreprocessor"));
77 TEST(dash_nostdinc_not_too_hard_for_direct_mode)
79 CHECK(!compopt_too_hard_for_direct_mode("-nostdinc"));
82 TEST(dash_I_takes_path)
84 CHECK(compopt_takes_path("-I"));
87 TEST(dash_Xlinker_takes_arg)
89 CHECK(compopt_takes_arg("-Xlinker"));
92 TEST(dash_xxx_doesnt_take_arg)
94 CHECK(!compopt_takes_arg("-xxx"));