Skip to content

Commit 985be8c

Browse files
Move to integration tests
1 parent 3ff9de6 commit 985be8c

File tree

6 files changed

+40
-30
lines changed

6 files changed

+40
-30
lines changed

.github/workflows/rust.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,4 @@ jobs:
3131
- name: Verify regenerated files
3232
run: ./scripts/unicode.py && diff tables.rs src/tables.rs
3333
- name: Verify regenerated tests
34-
run: ./scripts/unicode_gen_breaktests.py && rustfmt testdata.rs && diff testdata.rs src/testdata.rs
34+
run: ./scripts/unicode_gen_breaktests.py && rustfmt testdata.rs && diff testdata.rs tests/testdata/mod.rs

scripts/unicode.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -431,3 +431,22 @@ def emit_break_module(f, break_table, break_cats, name):
431431
sentence_table.extend([(x, y, cat) for (x, y) in sentence_cats[cat]])
432432
sentence_table.sort(key=lambda w: w[0])
433433
emit_break_module(rf, sentence_table, list(sentence_cats.keys()), "sentence")
434+
435+
rf.write("""
436+
#[cfg(test)]
437+
mod tests {
438+
#[test]
439+
fn test_syriac_abbr_mark() {
440+
use crate::tables::word as wd;
441+
let (_, _, cat) = wd::word_category('\\u{70f}');
442+
assert_eq!(cat, wd::WC_ALetter);
443+
}
444+
445+
#[test]
446+
fn test_end_of_ayah_cat() {
447+
use crate::tables::word as wd;
448+
let (_, _, cat) = wd::word_category('\\u{6dd}');
449+
assert_eq!(cat, wd::WC_Numeric);
450+
}
451+
}
452+
""")

src/lib.rs

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,6 @@
5656
)]
5757
#![no_std]
5858

59-
#[cfg(test)]
60-
#[macro_use]
61-
extern crate std;
62-
63-
#[cfg(test)]
64-
#[macro_use]
65-
extern crate quickcheck;
66-
6759
pub use grapheme::{GraphemeCursor, GraphemeIncomplete};
6860
pub use grapheme::{GraphemeIndices, Graphemes};
6961
pub use sentence::{USentenceBoundIndices, USentenceBounds, UnicodeSentences};
@@ -76,11 +68,6 @@ mod tables;
7668
mod sentence;
7769
mod word;
7870

79-
#[cfg(test)]
80-
mod test;
81-
#[cfg(test)]
82-
mod testdata;
83-
8471
/// Methods for segmenting strings according to
8572
/// [Unicode Standard Annex #29](http://www.unicode.org/reports/tr29/).
8673
pub trait UnicodeSegmentation {

src/tables.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2990,3 +2990,20 @@ pub mod sentence {
29902990
];
29912991

29922992
}
2993+
2994+
#[cfg(test)]
2995+
mod tests {
2996+
#[test]
2997+
fn test_syriac_abbr_mark() {
2998+
use crate::tables::word as wd;
2999+
let (_, _, cat) = wd::word_category('\u{70f}');
3000+
assert_eq!(cat, wd::WC_ALetter);
3001+
}
3002+
3003+
#[test]
3004+
fn test_end_of_ayah_cat() {
3005+
use crate::tables::word as wd;
3006+
let (_, _, cat) = wd::word_category('\u{6dd}');
3007+
assert_eq!(cat, wd::WC_Numeric);
3008+
}
3009+
}

src/test.rs renamed to tests/test.rs

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,10 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
use super::UnicodeSegmentation;
11+
use quickcheck::quickcheck;
12+
use unicode_segmentation::UnicodeSegmentation;
1213

13-
use std::prelude::v1::*;
14+
mod testdata;
1415

1516
#[test]
1617
fn test_graphemes() {
@@ -215,20 +216,6 @@ fn test_sentences() {
215216
}
216217
}
217218

218-
#[test]
219-
fn test_syriac_abbr_mark() {
220-
use crate::tables::word as wd;
221-
let (_, _, cat) = wd::word_category('\u{70f}');
222-
assert_eq!(cat, wd::WC_ALetter);
223-
}
224-
225-
#[test]
226-
fn test_end_of_ayah_cat() {
227-
use crate::tables::word as wd;
228-
let (_, _, cat) = wd::word_category('\u{6dd}');
229-
assert_eq!(cat, wd::WC_Numeric);
230-
}
231-
232219
quickcheck! {
233220
fn quickcheck_forward_reverse_graphemes_extended(s: String) -> bool {
234221
let a = s.graphemes(true).collect::<Vec<_>>();
File renamed without changes.

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