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

Commit

Permalink
update test
Browse files Browse the repository at this point in the history
  • Loading branch information
tamada committed Sep 10, 2021
1 parent 5551e7d commit e1d0746
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 12 deletions.
7 changes: 3 additions & 4 deletions .github/workflows/coverage.yaml
Expand Up @@ -11,10 +11,9 @@ jobs:
uses: actions/checkout@v2
- name: Run tests
run: cargo +nightly tarpaulin --verbose --all-features --workspace --timeout 120 --out Lcov
- name: show current status
run: |
ls -F
cat lcov.info
# - name: show current status
# run: |
# ls -F
- name: Upload coverage
uses: coverallsapp/github-action@v1.0.1
with:
Expand Down
2 changes: 1 addition & 1 deletion docs/content/_index.md
Expand Up @@ -7,7 +7,7 @@ title: uniq2
[![codebeat badge](https://codebeat.co/badges/855266ea-99d4-4d80-ac43-81a1712f0f90)](https://codebeat.co/projects/github-com-tamada-uniq2-master)
[![Go Report Card](https://goreportcard.com/badge/github.com/tamada/uniq2)](https://goreportcard.com/report/github.com/tamada/uniq2)
[![License](https://img.shields.io/badge/License-WTFPL-blue.svg)](https://github.com/tamada/uniq2/blob/master/LICENSE)
[![Version](https://img.shields.io/badge/Version-1.1.1-yellowgreen.svg)](https://github.com/tamada/uniq2/releases/tag/v1.1.1)
[![Version](https://img.shields.io/badge/Version-1.0.1-yellowgreen.svg)](https://github.com/tamada/uniq2/releases/tag/v1.0.1)

## Description

Expand Down
8 changes: 7 additions & 1 deletion src/io.rs
Expand Up @@ -57,7 +57,7 @@ pub fn open(
}

mod tests {
use super::*;
use super::open_input;

#[test]
fn test_input_with_none() {
Expand All @@ -76,4 +76,10 @@ mod tests {
let input = open_input(Some("testdata/test1.txt".to_string()));
assert!(input.is_ok());
}

#[test]
fn test_input_with_no_exist_file() {
let input = open_input(Some("testdata/not_exist_file.txt".to_string()));
assert!(input.is_err());
}
}
1 change: 1 addition & 0 deletions src/main.rs
Expand Up @@ -4,6 +4,7 @@ mod cli;
mod io;
mod uniqer;

#[cfg(not(tarpaulin_include))]
fn main() {
let opts = cli::Opts::parse();

Expand Down
12 changes: 6 additions & 6 deletions src/uniqer.rs
Expand Up @@ -153,21 +153,21 @@ mod tests {

#[test]
fn test_default_uniqer_with_adjacent_and_ignore_case_delete() {
let mut uniqer = construct_uniqer(true, true, true);
let mut uniqer = construct_uniqer(true, true, false);
assert!(uniqer.next("hogehoge".to_string()).is_none());
assert!(uniqer.next("HOGEhoge".to_string()).is_some());
assert!(uniqer.next("hogehoge".to_string()).is_some());
assert!(uniqer.next("previous".to_string()).is_none());
assert!(uniqer.next("previous".to_string()).is_some());
assert!(uniqer.next("HOGEhoge".to_string()).is_none());
assert!(uniqer.next("hogehoge".to_string()).is_none());
}

#[test]
fn test_default_uniqer_with_none_adjacent_and_ignore_case_delete() {
let mut uniqer = construct_uniqer(false, true, true);
let mut uniqer = construct_uniqer(false, true, false);
assert!(uniqer.next("hogehoge".to_string()).is_none());
assert!(uniqer.next("HOGEhoge".to_string()).is_some());
assert!(uniqer.next("hogehoge".to_string()).is_some());
assert!(uniqer.next("previous".to_string()).is_none());
assert!(uniqer.next("previous".to_string()).is_some());
assert!(uniqer.next("HOGEhoge".to_string()).is_some());
assert!(uniqer.next("hogehoge".to_string()).is_some());
}
}

0 comments on commit e1d0746

Please sign in to comment.