Fix doc_test examples for 'common_prefix'

This commit is contained in:
KtorZ 2024-08-23 16:17:54 +02:00
parent c92b260260
commit a71d7c260c
No known key found for this signature in database
GPG Key ID: 33173CB6F77F4277
2 changed files with 9 additions and 7 deletions

View File

@ -25,8 +25,8 @@ use std::{
const MAX_COLUMNS: isize = 999;
const VERSION: &str = env!("CARGO_PKG_VERSION");
mod link_tree;
mod source_links;
pub mod link_tree;
pub mod source_links;
#[derive(Debug, PartialEq, Eq, Clone)]
pub struct DocFile {
@ -82,7 +82,7 @@ impl<'a> PageTemplate<'a> {
}
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone)]
struct DocLink {
pub struct DocLink {
indent: usize,
name: String,
path: String,

View File

@ -424,21 +424,23 @@ fn link_tree_5() {
/// Find the common module prefix between two module path, if any.
///
/// ```rust
/// ```
/// use aiken_project::docs::link_tree::common_prefix;
///
/// assert_eq!(
/// common_prefix("foo", "foo"),
/// Some("foo".to_string()),
/// )
/// );
///
/// assert_eq!(
/// common_prefix("aiken/list", "aiken/bytearray"),
/// Some("aiken".to_string()),
/// )
/// );
///
/// assert_eq!(
/// common_prefix("aiken/list", "cardano/asset"),
/// None,
/// )
/// );
/// ```
pub fn common_prefix(left: &str, right: &str) -> Option<String> {
let mut prefix = vec![];