Skip to content

Commit

Permalink
Run doc tests in CI (#1253)
Browse files Browse the repository at this point in the history
Nextest does not support doc tests
nextest-rs/nextest#16

- **Fix doc tests**
- **Run doc tests as part of CI**
  • Loading branch information
maciektr committed Apr 10, 2024
1 parent c594c9f commit 0002c65
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
9 changes: 9 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,15 @@ jobs:
- name: nextest partition ${{ matrix.partition }}/8
run: cargo nextest run --partition 'count:${{ matrix.partition }}/8' --archive-file 'nextest-archive-${{ matrix.platform.os }}.tar.zst'

test-doc:
name: doc tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- name: run tests
run: cargo test --doc

scarb-metadata-compatibility:
name: scarb-metadata compatibility check
runs-on: ubuntu-latest
Expand Down
6 changes: 3 additions & 3 deletions plugins/cairo-lang-macro/src/types/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ impl TokenStreamMetadata {
/// For instance, auxiliary data can be serialized as JSON.
///
/// ```
/// use cairo_lang_macro::{AuxData, ProcMacroResult, TokenStream, attribute_macro, post_process};
/// use cairo_lang_macro::{AuxData, ProcMacroResult, TokenStream, attribute_macro, post_process, PostProcessContext};
/// use serde::{Serialize, Deserialize};
/// #[derive(Debug, Serialize, Deserialize)]
/// struct SomeAuxDataFormat {
Expand All @@ -133,8 +133,8 @@ impl TokenStreamMetadata {
/// }
///
/// #[post_process]
/// pub fn callback(aux_data: Vec<AuxData>) {
/// let aux_data = aux_data.into_iter()
/// pub fn callback(context: PostProcessContext) {
/// let aux_data = context.aux_data.into_iter()
/// .map(|aux_data| {
/// let value: Vec<u8> = aux_data.into();
/// let aux_data: SomeAuxDataFormat = serde_json::from_slice(&value).unwrap();
Expand Down

0 comments on commit 0002c65

Please sign in to comment.