Skip to content

Commit 14e4a06

Browse files
Merge pull request #1 from savetheclocktower/possible-rng-fix
Update Catch2…
2 parents 5933fb4 + daddbad commit 14e4a06

File tree

9 files changed

+25950
-10557
lines changed

9 files changed

+25950
-10557
lines changed

benchmark/native/marker-index-benchmark.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#include <iostream>
33
#include <vector>
44
#include <stdlib.h>
5-
#include "catch.hpp"
5+
#include "catch_amalgamated.hpp"
66
#include "point.h"
77
#include "range.h"
88
#include "marker-index.h"

binding.gyp

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@
8585
}
8686
}],
8787
['OS=="win"', {
88-
'sources': [
88+
'sources': [
8989
'vendor/win-iconv/win_iconv.c',
9090
],
9191
'include_dirs': [
@@ -148,10 +148,16 @@
148148
"targets": [{
149149
"target_name": "tests",
150150
"type": "executable",
151+
"cflags_cc": ["-std=c++17"],
151152
"cflags_cc!": ["-fno-exceptions"],
152153
"defines": [
153-
"CATCH_CONFIG_CPP11_NO_IS_ENUM"
154+
"CATCH_CONFIG_CPP11_NO_IS_ENUM",
155+
"CATCH_CONFIG_CPP17_STRING_VIEW"
154156
],
157+
'xcode_settings': {
158+
'CLANG_CXX_LIBRARY': 'libc++',
159+
'CLANG_CXX_LANGUAGE_STANDARD': 'c++17',
160+
},
155161
"sources": [
156162
"test/native/test-helpers.cc",
157163
"test/native/tests.cc",
@@ -160,6 +166,7 @@
160166
"test/native/text-buffer-test.cc",
161167
"test/native/text-test.cc",
162168
"test/native/text-diff-test.cc",
169+
"vendor/catch_amalgamated.cpp"
163170
],
164171
"include_dirs": [
165172
"vendor",
@@ -175,7 +182,7 @@
175182
],
176183
"xcode_settings": {
177184
"GCC_ENABLE_CPP_EXCEPTIONS": "YES",
178-
'MACOSX_DEPLOYMENT_TARGET': '10.8',
185+
'MACOSX_DEPLOYMENT_TARGET': '10.12',
179186
}
180187
}]
181188
]
@@ -189,7 +196,8 @@
189196
['OS=="mac"', {
190197
"xcode_settings": {
191198
'CLANG_CXX_LIBRARY': 'libc++',
192-
'CLANG_CXX_LANGUAGE_STANDARD':'c++11',
199+
'CLANG_CXX_LANGUAGE_STANDARD': 'c++17',
200+
'GCC_SYMBOLS_PRIVATE_EXTERN': 'YES', # -fvisibility=hidden
193201
}
194202
}],
195203
['OS=="win"', {

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: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -338,20 +338,20 @@ TEST_CASE("TextBuffer::find") {
338338
Regex(u"(", &error_message);
339339
REQUIRE(error_message == u"missing closing parenthesis");
340340

341-
REQUIRE(buffer.find(Regex(u"", nullptr)) == (Range{{0, 0}, {0, 0}}));
342-
REQUIRE(TextBuffer().find(Regex(u"", nullptr)) == (Range{{0, 0}, {0, 0}}));
341+
REQUIRE(*buffer.find(Regex(u"", nullptr)) == (Range{{0, 0}, {0, 0}}));
342+
REQUIRE(*TextBuffer().find(Regex(u"", nullptr)) == (Range{{0, 0}, {0, 0}}));
343343

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

353353
buffer.reset(Text{u"a1b"});
354-
REQUIRE(buffer.find(Regex(u"\\d", nullptr)) == (Range{{0, 1}, {0, 2}}));
354+
REQUIRE(*buffer.find(Regex(u"\\d", nullptr)) == (Range{{0, 1}, {0, 2}}));
355355
}
356356

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

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

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

0 commit comments

Comments
 (0)