Skip to content

Commit

Permalink
Fix missing docs on tests
Browse files Browse the repository at this point in the history
  • Loading branch information
aborgna-q committed Nov 25, 2024
1 parent 592f54e commit 168d28e
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 1 deletion.
1 change: 1 addition & 0 deletions hugr-core/src/extension.rs
Original file line number Diff line number Diff line change
Expand Up @@ -611,6 +611,7 @@ impl FromIterator<ExtensionId> for ExtensionSet {
}
}

/// Extension tests.
#[cfg(test)]
pub mod test {
// We re-export this here because mod op_def is private.
Expand Down
2 changes: 2 additions & 0 deletions hugr-core/src/extension/op_def.rs
Original file line number Diff line number Diff line change
Expand Up @@ -514,10 +514,12 @@ pub(super) mod test {
const EXT_ID: ExtensionId = "MyExt";
}

/// A dummy wrapper over an operation definition.
#[derive(serde::Serialize, serde::Deserialize, Debug)]
pub struct SimpleOpDef(OpDef);

impl SimpleOpDef {
/// Create a new dummy opdef.
pub fn new(op_def: OpDef) -> Self {
assert!(op_def.constant_folder.is_none());
assert!(matches!(
Expand Down
4 changes: 4 additions & 0 deletions hugr-core/src/hugr/serialize/test.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//! Tests for the HUGR serialization format.
use super::*;
use crate::builder::{
endo_sig, inout_sig, test::closed_dfg_root_hugr, Container, DFGBuilder, Dataflow, DataflowHugr,
Expand Down Expand Up @@ -182,13 +184,15 @@ pub fn check_hugr_roundtrip(hugr: &Hugr, check_schema: bool) -> Hugr {
new_hugr
}

/// Deserialize a HUGR json, ensuring that it is valid against the schema.
pub fn check_hugr_deserialize(hugr: &Hugr, value: serde_json::Value, check_schema: bool) -> Hugr {
let new_hugr = ser_deserialize_check_schema(value, get_schemas(check_schema));

check_hugr(hugr, &new_hugr);
new_hugr
}

/// Check that two HUGRs are equivalent, up to node renumbering.
pub fn check_hugr(lhs: &Hugr, rhs: &Hugr) {
// Original HUGR, with canonicalized node indices
//
Expand Down
2 changes: 2 additions & 0 deletions hugr-core/src/proptest.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//! Generator functions for property testing the Hugr data structures.
use ::proptest::collection::vec;
use ::proptest::prelude::*;
use lazy_static::lazy_static;
Expand Down
2 changes: 1 addition & 1 deletion hugr-core/src/types/custom.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ impl From<CustomType> for Type {
}

#[cfg(test)]
pub mod test {
mod test {

pub mod proptest {
use crate::extension::ExtensionId;
Expand Down
2 changes: 2 additions & 0 deletions hugr-core/tests/model.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![allow(missing_docs)]

use hugr::std_extensions::std_reg;
use hugr_core::{export::export_hugr, import::import_hugr};
use hugr_model::v0 as model;
Expand Down
2 changes: 2 additions & 0 deletions hugr-model/tests/binary.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![allow(missing_docs)]

use bumpalo::Bump;
use hugr_model::v0 as model;
use pretty_assertions::assert_eq;
Expand Down
2 changes: 2 additions & 0 deletions hugr-model/tests/text.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![allow(missing_docs)]

use hugr_model::v0 as model;

fn roundtrip(source: &str) -> String {
Expand Down

0 comments on commit 168d28e

Please sign in to comment.