Skip to content

Commit 4be51f9

Browse files
committed
remove files that broke windows ci, updatedb: fix large negative deltas
1 parent b450825 commit 4be51f9

File tree

6 files changed

+23
-18
lines changed

6 files changed

+23
-18
lines changed

src/updatedb/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ impl Iterator for Frcoder<'_> {
220220
// if the prefix delta exceeds 0x7f, we use 0x80 to signal that the next two bytes comprise
221221
// the delta
222222
let mut out = Vec::new();
223-
if diff > 0x7f {
223+
if diff.abs() > 0x7f {
224224
out.push(0x80);
225225
out.extend((diff as i16).to_be_bytes());
226226
} else {

test_data/db/abc def

Whitespace-only changes.

test_data/db/abc def

Whitespace-only changes.

test_data/db/✨sparkles✨

Whitespace-only changes.

test_data_db

183 Bytes
Binary file not shown.

tests/db_tests.rs

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,18 @@
66

77
mod common;
88

9-
use std::process::Command;
9+
use std::{fs::File, io, process::Command};
1010

1111
use assert_cmd::{assert::OutputAssertExt, cargo::CommandCargoExt};
12-
use rstest::rstest;
13-
14-
use crate::common::test_helpers::fix_up_slashes;
12+
use rstest::{fixture, rstest};
13+
14+
#[fixture]
15+
fn add_special_files() -> io::Result<()> {
16+
File::create("test_data/db/abc def")?;
17+
File::create("test_data/db/abc\ndef")?;
18+
File::create("test_data/db/✨sparkles✨")?;
19+
Ok(())
20+
}
1521

1622
#[cfg(not(windows))]
1723
const DB_FLAG: &str = "--database=test_data_db";
@@ -76,14 +82,16 @@ fn test_locate_non_existing() {
7682
.failure();
7783
}
7884

79-
#[test]
85+
#[rstest]
8086
#[cfg(not(windows))]
81-
fn test_locate_statistics() {
82-
Command::cargo_bin("locate")
83-
.expect("couldn't find locate binary")
84-
.args(["abbbc", "--statistics", DB_FLAG])
85-
.assert()
86-
.success();
87+
fn test_locate_statistics(add_special_files: io::Result<()>) {
88+
if add_special_files.is_ok() {
89+
Command::cargo_bin("locate")
90+
.expect("couldn't find locate binary")
91+
.args(["abbbc", "--statistics", DB_FLAG])
92+
.assert()
93+
.success();
94+
}
8795
}
8896

8997
#[rstest]
@@ -125,15 +133,12 @@ fn test_locate_all_regex() {
125133
.success();
126134
}
127135

128-
#[test]
136+
#[rstest]
129137
#[cfg(not(windows))]
130-
fn test_updatedb() {
138+
fn test_updatedb(_add_special_files: io::Result<()>) {
131139
Command::cargo_bin("updatedb")
132140
.expect("couldn't find updatedb binary")
133-
.args([
134-
fix_up_slashes("--localpaths=./test_data"),
135-
fix_up_slashes("--output=/dev/null"),
136-
])
141+
.args(["--localpaths=./test_data", "--output=/dev/null"])
137142
.assert()
138143
.success();
139144
}

0 commit comments

Comments
 (0)