|
| 1 | +// Copyright (C) 2020 Matthew Glazar |
| 2 | +// See end of file for extended copyright information. |
| 3 | + |
| 4 | +#ifndef QUICK_LINT_JS_FILE_MATCHER_H |
| 5 | +#define QUICK_LINT_JS_FILE_MATCHER_H |
| 6 | + |
| 7 | +#include <gtest/gtest.h> |
| 8 | +#include <quick-lint-js/file.h> |
| 9 | + |
| 10 | +#define EXPECT_SAME_FILE(path_a, path_b) \ |
| 11 | + do { \ |
| 12 | + ::quick_lint_js::canonical_path_result path_a_canonical_ = \ |
| 13 | + ::quick_lint_js::canonicalize_path((path_a)); \ |
| 14 | + ASSERT_TRUE(path_a_canonical_.ok()) \ |
| 15 | + << std::move(path_a_canonical_).error(); \ |
| 16 | + ::quick_lint_js::canonical_path_result path_b_canonical_ = \ |
| 17 | + ::quick_lint_js::canonicalize_path((path_b)); \ |
| 18 | + ASSERT_TRUE(path_b_canonical_.ok()) \ |
| 19 | + << std::move(path_b_canonical_).error(); \ |
| 20 | + EXPECT_EQ(path_a_canonical_.path(), path_b_canonical_.path()) \ |
| 21 | + << (path_a) << " should be the same file as " << (path_b); \ |
| 22 | + } while (false) |
| 23 | + |
| 24 | +#endif |
| 25 | + |
| 26 | +// quick-lint-js finds bugs in JavaScript programs. |
| 27 | +// Copyright (C) 2020 Matthew Glazar |
| 28 | +// |
| 29 | +// This file is part of quick-lint-js. |
| 30 | +// |
| 31 | +// quick-lint-js is free software: you can redistribute it and/or modify |
| 32 | +// it under the terms of the GNU General Public License as published by |
| 33 | +// the Free Software Foundation, either version 3 of the License, or |
| 34 | +// (at your option) any later version. |
| 35 | +// |
| 36 | +// quick-lint-js is distributed in the hope that it will be useful, |
| 37 | +// but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 38 | +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 39 | +// GNU General Public License for more details. |
| 40 | +// |
| 41 | +// You should have received a copy of the GNU General Public License |
| 42 | +// along with quick-lint-js. If not, see <https://www.gnu.org/licenses/>. |
0 commit comments