Skip to content

Commit

Permalink
test: add cov report (#32)
Browse files Browse the repository at this point in the history
* test: Add cov ci

* test: more test
  • Loading branch information
quininer authored Aug 17, 2024
1 parent 3384682 commit ef014bc
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 21 deletions.
42 changes: 21 additions & 21 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,14 @@ jobs:

steps:
- name: Checkout sources
uses: actions/checkout@v2

- name: Install nightly toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly
override: true

- name: Check
uses: actions/checkout@v4
- name: Install Rust
run: rustup update stable
- name: Check minimum
run: cargo check --all
- name: Check serde + use_alloc
run: cargo check --all --features serde1,use_alloc
- name: Check all
run: cargo check --all --all-features --all-targets

test:
Expand All @@ -34,15 +32,17 @@ jobs:
RUSTFLAGS: "-D warnings"

steps:
- uses: actions-rs/toolchain@v1
- name: Checkout sources
uses: actions/checkout@v4
- name: Install Rust
run: rustup update stable
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov
- name: Test all
run: cargo llvm-cov test --all --all-features --lcov --output-path lcov.info
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
profile: minimal
toolchain: nightly
override: true
- uses: actions/checkout@master
- name: minimum feature
run: cargo test --all
- name: all feature
run: cargo test --all --all-features
- name: serde + use_alloc
run: cargo test --all --features serde1,use_alloc
token: ${{ secrets.CODECOV_TOKEN }}
files: lcov.info
fail_ci_if_error: true
11 changes: 11 additions & 0 deletions tests/decode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -289,3 +289,14 @@ fn test_ignored_any_eof_loop() {
_ => panic!()
}
}

#[test]
fn test_cov_u16() {
let mut buf = BufWriter::new(Vec::new());
u16::MAX.encode(&mut buf).unwrap();

let mut reader = SliceReader::new(buf.buffer());
let v = u16::decode(&mut reader).unwrap();

assert_eq!(v, u16::MAX);
}

0 comments on commit ef014bc

Please sign in to comment.