8000 Fix CI, address review comments · ryanavella/unicode-segmentation@b8519e9 · GitHub
[go: up one dir, main page]

Skip to content

Commit b8519e9

Browse files
Fix CI, address review comments
1 parent 8a26b3e commit b8519e9

File tree

7 files changed

+8039
-3442
lines changed

7 files changed

+8039
-3442
lines changed

.github/workflows/rust.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,6 @@ jobs:
3232
- name: Rustfmt
3333
run: cargo fmt --all --check
3434
- name: Verify regenerated files
35-
run: ./scripts/unicode.py && diff tables.rs src/tables.rs
35+
run: ./scripts/unicode.py && rustfmt tables.rs && diff tables.rs src/tables.rs
3636
- name: Verify regenerated tests
3737
run: ./scripts/unicode_gen_breaktests.py && rustfmt testdata.rs && diff testdata.rs tests/testdata/mod.rs

scripts/unicode.py

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -453,22 +453,3 @@ def emit_break_module(f, break_table, break_cats, name):
453453
sentence_table.extend([(x, y, cat) for (x, y) in sentence_cats[cat]])
454454
sentence_table.sort(key=lambda w: w[0])
455455
emit_break_module(rf, sentence_table, list(sentence_cats.keys()), "sentence")
456-
457-
rf.write("""
458-
#[cfg(test)]
459-
mod tests {
460-
#[test]
461-
fn test_syriac_abbr_mark() {
462-
use crate::tables::word as wd;
463-
let (_, _, cat) = wd::word_category('\\u{70f}');
464-
assert_eq!(cat, wd::WC_ALetter);
465-
}
466-
467-
#[test]
468-
fn test_end_of_ayah_cat() {
469-
use crate::tables::word as wd;
470-
let (_, _, cat) = wd::word_category('\\u{6dd}');
471-
assert_eq!(cat, wd::WC_Numeric);
472-
}
473-
}
474-
""")

src/lib.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,8 @@ pub use tables::UNICODE_VERSION;
6363
pub use word::{UWordBoundIndices, UWordBounds, UnicodeWordIndices, UnicodeWords};
6464

6565
mod grapheme;
66-
#[rustfmt::skip]
67-
mod tables;
6866
mod sentence;
67+
mod tables;
6968
mod word;
7069

7170
/// Methods for segmenting strings according to

src/tables.rs

Lines changed: 6241 additions & 2604 deletions
Large diffs are not rendered by default.

src/word.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -760,3 +760,20 @@ pub fn new_unicode_word_indices(s: &str) -> UnicodeWordIndices<'_> {
760760
.filter(|(_, c)| has_alphanumeric(c)),
761761
}
762762
}
763+
764+
#[cfg(test)]
765+
mod tests {
766+
#[test]
767+
fn test_syriac_abbr_mark() {
768+
use crate::tables::word as wd;
769+
let (_, _, cat) = wd::word_category('\u{70f}');
770+
assert_eq!(cat, wd::WC_ALetter);
771+
}
772+
773+
#[test]
774+
fn test_end_of_ayah_cat() {
775+
use crate::tables::word as wd;
776+
let (_, _, cat) = wd::word_category('\u{6dd}');
777+
assert_eq!(cat, wd::WC_Numeric);
778+
}
779+
}

tests/test.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
use quickcheck::quickcheck;
1212
use unicode_segmentation::UnicodeSegmentation;
1313

14-
#[rustfmt::skip]
1514
mod testdata;
1615

1716
#[test]

tests/testdata/mod.rs

Lines changed: 1779 additions & 815 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)
0