Skip to content

Commit 66cce2c

Browse files
authored
Merge pull request #16 from atom-community/catch2 [skip ci]
2 parents 23f0243 + 11d732e commit 66cce2c

File tree

10 files changed

+22609
-11726
lines changed

10 files changed

+22609
-11726
lines changed

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
vendor/ linguist-vendored

.github/workflows/ci.yml

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,9 @@ jobs:
1616
- macos-latest
1717
- windows-2019
1818
node_version:
19-
- 10
2019
- 12
2120
- 14
22-
name: Node ${{ matrix.node_version }} on ${{ matrix.os }}
23-
21+
- 16
2422
steps:
2523
- uses: actions/checkout@v3
2624
with:
@@ -55,10 +53,3 @@ jobs:
5553
run: |
5654
npm run test:node
5755
npm run test:native
58-
59-
Skip:
60-
if: contains(github.event.head_commit.message, '[skip ci]')
61-
runs-on: ubuntu-latest
62-
steps:
63-
- name: Skip CI 🚫
64-
run: echo skip ci

binding.gyp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,8 @@
8080
"target_name": "tests",
8181
"type": "executable",
8282
"cflags_cc!": ["-fno-exceptions"],
83-
"defines": [
84-
"CATCH_CONFIG_CPP11_NO_IS_ENUM"
85-
],
8683
"sources": [
84+
"vendor/catch_amalgamated.cpp",
8785
"test/native/test-helpers.cc",
8886
"test/native/tests.cc",
8987
"test/native/encoding-conversion-test.cc",

test/native/test-helpers.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#include "patch.h"
33
#include "range.h"
44
#include "text-buffer.h"
5-
#include <catch.hpp>
5+
#include <catch_amalgamated.hpp>
66
#include <cstring>
77
#include <memory>
88
#include <ostream>

test/native/test-helpers.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#define SUPERSTRING_TEST_HELPERS_H
33

44
#include "patch.h"
5-
#include <catch.hpp>
5+
#include <catch_amalgamated.hpp>
66
#include <cstring>
77
#include <memory>
88
#include <ostream>

test/native/tests.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
// for a faster feedback loop
33

44
#define CATCH_CONFIG_MAIN
5-
#include <catch.hpp>
5+
#include <catch_amalgamated.hpp>

test/native/text-buffer-test.cc

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -339,20 +339,20 @@ TEST_CASE("TextBuffer::find") {
339339
Regex(u"(", &error_message);
340340
REQUIRE(error_message == u"missing closing parenthesis");
341341

342-
REQUIRE(buffer.find(Regex(u"", nullptr)) == (Range{{0, 0}, {0, 0}}));
343-
REQUIRE(TextBuffer().find(Regex(u"", nullptr)) == (Range{{0, 0}, {0, 0}}));
342+
REQUIRE(buffer.find(Regex(u"", nullptr)) == optional<Range>(Range{{0, 0}, {0, 0}}));
343+
REQUIRE(TextBuffer().find(Regex(u"", nullptr)) == optional<Range>(Range{{0, 0}, {0, 0}}));
344344

345-
REQUIRE(buffer.find(Regex(u"ef*", nullptr)) == (Range{{1, 0}, {1, 2}}));
345+
REQUIRE(buffer.find(Regex(u"ef*", nullptr)) == optional<Range>(Range{{1, 0}, {1, 2}}));
346346
REQUIRE(buffer.find(Regex(u"x", nullptr)) == optional<Range>{});
347-
REQUIRE(buffer.find(Regex(u"c.", nullptr)) == (Range{{0, 2}, {0, 4}}));
348-
REQUIRE(buffer.find(Regex(u"d", nullptr)) == (Range{{0, 3}, {0, 4}}));
349-
REQUIRE(buffer.find(Regex(u"\\n", nullptr)) == (Range{{0, 4}, {1, 0}}));
350-
REQUIRE(buffer.find(Regex(u"\\be", nullptr)) == (Range{{1, 0}, {1, 1}}));
351-
REQUIRE(buffer.find(Regex(u"^e", nullptr)) == (Range{{1, 0}, {1, 1}}));
352-
REQUIRE(buffer.find(Regex(u"^(e|d)g?", nullptr)) == (Range{{1, 0}, {1, 1}}));
347+
REQUIRE(buffer.find(Regex(u"c.", nullptr)) == optional<Range>(Range{{0, 2}, {0, 4}}));
348+
REQUIRE(buffer.find(Regex(u"d", nullptr)) == optional<Range>(Range{{0, 3}, {0, 4}}));
349+
REQUIRE(buffer.find(Regex(u"\\n", nullptr)) == optional<Range>(Range{{0, 4}, {1, 0}}));
350+
REQUIRE(buffer.find(Regex(u"\\be", nullptr)) == optional<Range>(Range{{1, 0}, {1, 1}}));
351+
REQUIRE(buffer.find(Regex(u"^e", nullptr)) == optional<Range>(Range{{1, 0}, {1, 1}}));
352+
REQUIRE(buffer.find(Regex(u"^(e|d)g?", nullptr)) == optional<Range>(Range{{1, 0}, {1, 1}}));
353353

354354
buffer.reset(Text{u"a1b"});
355-
REQUIRE(buffer.find(Regex(u"\\d", nullptr)) == (Range{{0, 1}, {0, 2}}));
355+
REQUIRE(buffer.find(Regex(u"\\d", nullptr)) == optional<Range>(Range{{0, 1}, {0, 2}}));
356356
}
357357

358358
TEST_CASE("TextBuffer::find - spanning edits") {
@@ -361,17 +361,17 @@ TEST_CASE("TextBuffer::find - spanning edits") {
361361
buffer.set_text_in_range({{0, 9}, {0, 9}}, u"67890");
362362

363363
REQUIRE(buffer.text() == u"ab12345cd67890");
364-
REQUIRE(buffer.find(Regex(u"b1234", nullptr)) == (Range{{0, 1}, {0, 6}}));
365-
REQUIRE(buffer.find(Regex(u"b12345c", nullptr)) == (Range{{0, 1}, {0, 8}}));
366-
REQUIRE(buffer.find(Regex(u"b12345cd6", nullptr)) == (Range{{0, 1}, {0, 10}}));
367-
REQUIRE(buffer.find(Regex(u"345[a-z][a-z]", nullptr)) == (Range{{0, 4}, {0, 9}}));
368-
REQUIRE(buffer.find(Regex(u"5cd6", nullptr)) == (Range{{0, 6}, {0, 10}}));
364+
REQUIRE(buffer.find(Regex(u"b1234", nullptr)) == optional<Range>(Range{{0, 1}, {0, 6}}));
365+
REQUIRE(buffer.find(Regex(u"b12345c", nullptr)) == optional<Range>(Range{{0, 1}, {0, 8}}));
366+
REQUIRE(buffer.find(Regex(u"b12345cd6", nullptr)) == optional<Range>(Range{{0, 1}, {0, 10}}));
367+
REQUIRE(buffer.find(Regex(u"345[a-z][a-z]", nullptr)) == optional<Range>(Range{{0, 4}, {0, 9}}));
368+
REQUIRE(buffer.find(Regex(u"5cd6", nullptr)) == optional<Range>(Range{{0, 6}, {0, 10}}));
369369

370370
buffer.reset(Text{u"abcdef"});
371371
buffer.set_text_in_range({{0, 2}, {0, 4}}, u"");
372372
REQUIRE(buffer.text() == u"abef");
373-
REQUIRE(buffer.find(Regex(u"abe", nullptr)) == (Range{{0, 0}, {0, 3}}));
374-
REQUIRE(buffer.find(Regex(u"bef", nullptr)) == (Range{{0, 1}, {0, 4}}));
373+
REQUIRE(buffer.find(Regex(u"abe", nullptr)) == optional<Range>(Range{{0, 0}, {0, 3}}));
374+
REQUIRE(buffer.find(Regex(u"bef", nullptr)) == optional<Range>(Range{{0, 1}, {0, 4}}));
375375
REQUIRE(buffer.find(Regex(u"bc", nullptr)) == optional<Range>{});
376376
}
377377

@@ -584,10 +584,10 @@ TEST_CASE("TextBuffer - random edits and queries") {
584584

585585
MatchResult match_result = regex.match(mutated_text.data(), mutated_text.size(), match_data);
586586
if (match_result.type == MatchResult::Partial || match_result.type == MatchResult::Full) {
587-
REQUIRE(search_result == (Range{
588-
mutated_text.position_for_offset(match_result.start_offset),
589-
mutated_text.position_for_offset(match_result.end_offset),
590-
}));
587+
REQUIRE(search_result == optional<Range>(Range{
588+
mutated_text.position_for_offset(match_result.start_offset),
589+
mutated_text.position_for_offset(match_result.end_offset),
590+
}));
591591
} else {
592592
REQUIRE(search_result == optional<Range>());
593593
}

0 commit comments

Comments
 (0)