Skip to content
This repository was archived by the owner on Dec 15, 2022. It is now read-only.

Commit 17c3008

Browse files
committed
Use std::chrono and std::sleep_for instead of usleep
usleep is specific to Linux
1 parent ab02ccf commit 17c3008

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

test/native/text-buffer-test.cc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
#include "text-slice.h"
55
#include "regex.h"
66
#include <future>
7-
#include <unistd.h>
7+
#include <chrono>
8+
#include <thread>
89

910
using std::move;
1011
using std::pair;
@@ -535,7 +536,7 @@ TEST_CASE("TextBuffer - random edits and queries") {
535536
Generator rand(seed);
536537
vector<SnapshotData> results;
537538
for (uint32_t k = 0; k < 5; k++) {
538-
usleep(rand() % 1000);
539+
std::this_thread::sleep_for(std::chrono::microseconds(rand() % 1000));
539540
vector<Point> line_ending_positions;
540541
for (uint32_t row = 0; row < snapshot->extent().row; row++) {
541542
line_ending_positions.push_back({row, snapshot->line_length_for_row(row)});

0 commit comments

Comments
 (0)