Fix doc_test examples for 'common_prefix'
This commit is contained in:
parent
c92b260260
commit
a71d7c260c
|
@ -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,
|
||||
|
|
|
@ -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![];
|
||||
|
|
Loading…
Reference in New Issue