Skip to content

Commit 7c8a272

Browse files
Check benches and fuzz tests in CI
1 parent a6a221a commit 7c8a272

File tree

3 files changed

+21
-7
lines changed

3 files changed

+21
-7
lines changed

.github/workflows/rust.yml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,18 @@ jobs:
4949
run: cargo fmt --all --check
5050
- name: Check clippy
5151
if: matrix.rust == 'stable'
52-
run: cargo clippy --all-features --all --verbose
52+
run: cargo clippy --all-features --lib --tests --examples --verbose
53+
- name: Check benchmarks with clippy
54+
if: matrix.rust == 'nightly'
55+
run: cargo clippy --all-features --benches --verbose
56+
- name: Check fuzz tests with clippy
57+
if: matrix.rust == 'stable'
58+
working-directory: fuzz
59+
run: cargo clippy --all-features --all-targets --verbose
60+
- name: Check fuzz tests formatting
61+
if: matrix.rust == 'stable'
62+
working-directory: fuzz
63+
run: cargo fmt --all --check
5364
msrv:
5465
runs-on: ubuntu-latest
5566
steps:

benches/bench.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ use std::fs;
77
use test::Bencher;
88
use unicode_normalization::UnicodeNormalization;
99

10-
const ASCII: &'static str = "all types of normalized";
11-
const NFC: &'static str = "Introducci\u{00f3}n a Unicode.pdf";
12-
const NFD: &'static str = "Introduccio\u{0301}n a Unicode.pdf";
10+
const ASCII: &str = "all types of normalized";
11+
const NFC: &str = "Introducci\u{00f3}n a Unicode.pdf";
12+
const NFD: &str = "Introduccio\u{0301}n a Unicode.pdf";
1313

1414
#[bench]
1515
fn bench_is_nfc_ascii(b: &mut Bencher) {

fuzz/fuzz_targets/streaming.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313
#[macro_use]
1414
extern crate libfuzzer_sys;
1515

16-
use std::str::Chars;
1716
use std::cell::RefCell;
1817
use std::rc::Rc;
18+
use std::str::Chars;
1919
use unicode_normalization::{char::canonical_combining_class, UnicodeNormalization};
2020

2121
const MAX_NONSTARTERS: u32 = 30;
@@ -43,8 +43,11 @@ impl<'a> Iterator for Counter<'a> {
4343
fuzz_target!(|input: String| {
4444
let stream_safe = input.chars().stream_safe().collect::<String>();
4545

46-
let mut value = Rc::new(RefCell::new(0));
47-
let counter = Counter { iter: stream_safe.chars(), value: Rc::clone(&mut value) };
46+
let value = Rc::new(RefCell::new(0));
47+
let counter = Counter {
48+
iter: stream_safe.chars(),
49+
value: Rc::clone(&value),
50+
};
4851
for _ in counter.nfc() {
4952
// Plus 1: The iterator may consume a starter that begins the next sequence.
5053
assert!(*value.borrow() <= MAX_NONSTARTERS + 1);

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy