Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit985be8c

Browse files
Move to integration tests
1 parent3ff9de6 commit985be8c

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.rssrc/testdata.rs
34+
run:./scripts/unicode_gen_breaktests.py && rustfmt testdata.rs && diff testdata.rstests/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)insentence_cats[cat]])
432432
sentence_table.sort(key=lambdaw: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-
externcrate std;
62-
63-
#[cfg(test)]
64-
#[macro_use]
65-
externcrate quickcheck;
66-
6759
pubuse grapheme::{GraphemeCursor,GraphemeIncomplete};
6860
pubuse grapheme::{GraphemeIndices,Graphemes};
6961
pubuse 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
pubtraitUnicodeSegmentation{

‎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+
fntest_syriac_abbr_mark(){
2998+
usecrate::tables::wordas wd;
2999+
let(_, _, cat) = wd::word_category('\u{70f}');
3000+
assert_eq!(cat, wd::WC_ALetter);
3001+
}
3002+
3003+
#[test]
3004+
fntest_end_of_ayah_cat(){
3005+
usecrate::tables::wordas wd;
3006+
let(_, _, cat) = wd::word_category('\u{6dd}');
3007+
assert_eq!(cat, wd::WC_Numeric);
3008+
}
3009+
}

‎src/test.rsrenamed 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-
usesuper::UnicodeSegmentation;
11+
use quickcheck::quickcheck;
12+
use unicode_segmentation::UnicodeSegmentation;
1213

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

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

218-
#[test]
219-
fntest_syriac_abbr_mark(){
220-
usecrate::tables::wordas wd;
221-
let(_, _, cat) = wd::word_category('\u{70f}');
222-
assert_eq!(cat, wd::WC_ALetter);
223-
}
224-
225-
#[test]
226-
fntest_end_of_ayah_cat(){
227-
usecrate::tables::wordas 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)

[8]ページ先頭

©2009-2025 Movatter.jp