Skip to content
This repository has been archived by the owner on Sep 10, 2022. It is now read-only.

Commit

Permalink
Merge pull request #18 from Berrysoft/citest
Browse files Browse the repository at this point in the history
Add test in CI.
  • Loading branch information
Berrysoft committed Aug 23, 2022
2 parents ae2e075 + 9b99611 commit 4ebaaa0
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 5 deletions.
1 change: 0 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
.PHONY: test clean update doc serve-book
test: plugins
cd utils && $(MAKE) test
cd book && $(MAKE) test
clean:
cd bins && $(MAKE) clean
cd utils && $(MAKE) clean
Expand Down
3 changes: 3 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,5 +68,8 @@ jobs:
- pwsh: make plugins
displayName: "Build plugins"

- pwsh: make test
displayName: "Test"

- pwsh: make release-cross TARGET=$(target)
displayName: "Build all"
2 changes: 0 additions & 2 deletions book/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,5 @@ build:
mdbook build
serve:
mdbook serve --open
test:
mdbook test
clean:
mdbook clean
16 changes: 14 additions & 2 deletions utils/gal-locale/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,13 +103,25 @@ mod test {

#[test]
fn accept() {
let current = "zh-CN".parse::<Locale>().unwrap();
let accepts = [
"en".parse::<Locale>().unwrap(),
"ja".parse().unwrap(),
"zh-Hans".parse().unwrap(),
"zh-Hant".parse().unwrap(),
];
assert_eq!(current.choose_from(accepts).unwrap().to_string(), "zh-Hans");
assert_eq!(
"zh_CN"
.parse::<Locale>()
.unwrap()
.choose_from(accepts.clone()),
Some("zh_Hans".parse::<Locale>().unwrap())
);
assert_eq!(
"zh_TW"
.parse::<Locale>()
.unwrap()
.choose_from(accepts.clone()),
Some("zh_Hant".parse::<Locale>().unwrap())
);
}
}

0 comments on commit 4ebaaa0

Please sign in to comment.