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 MAX_COLUMNS: isize = 999;
|
||||||
const VERSION: &str = env!("CARGO_PKG_VERSION");
|
const VERSION: &str = env!("CARGO_PKG_VERSION");
|
||||||
|
|
||||||
mod link_tree;
|
pub mod link_tree;
|
||||||
mod source_links;
|
pub mod source_links;
|
||||||
|
|
||||||
#[derive(Debug, PartialEq, Eq, Clone)]
|
#[derive(Debug, PartialEq, Eq, Clone)]
|
||||||
pub struct DocFile {
|
pub struct DocFile {
|
||||||
|
@ -82,7 +82,7 @@ impl<'a> PageTemplate<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone)]
|
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone)]
|
||||||
struct DocLink {
|
pub struct DocLink {
|
||||||
indent: usize,
|
indent: usize,
|
||||||
name: String,
|
name: String,
|
||||||
path: String,
|
path: String,
|
||||||
|
|
|
@ -424,21 +424,23 @@ fn link_tree_5() {
|
||||||
|
|
||||||
/// Find the common module prefix between two module path, if any.
|
/// Find the common module prefix between two module path, if any.
|
||||||
///
|
///
|
||||||
/// ```rust
|
/// ```
|
||||||
|
/// use aiken_project::docs::link_tree::common_prefix;
|
||||||
|
///
|
||||||
/// assert_eq!(
|
/// assert_eq!(
|
||||||
/// common_prefix("foo", "foo"),
|
/// common_prefix("foo", "foo"),
|
||||||
/// Some("foo".to_string()),
|
/// Some("foo".to_string()),
|
||||||
/// )
|
/// );
|
||||||
///
|
///
|
||||||
/// assert_eq!(
|
/// assert_eq!(
|
||||||
/// common_prefix("aiken/list", "aiken/bytearray"),
|
/// common_prefix("aiken/list", "aiken/bytearray"),
|
||||||
/// Some("aiken".to_string()),
|
/// Some("aiken".to_string()),
|
||||||
/// )
|
/// );
|
||||||
///
|
///
|
||||||
/// assert_eq!(
|
/// assert_eq!(
|
||||||
/// common_prefix("aiken/list", "cardano/asset"),
|
/// common_prefix("aiken/list", "cardano/asset"),
|
||||||
/// None,
|
/// None,
|
||||||
/// )
|
/// );
|
||||||
/// ```
|
/// ```
|
||||||
pub fn common_prefix(left: &str, right: &str) -> Option<String> {
|
pub fn common_prefix(left: &str, right: &str) -> Option<String> {
|
||||||
let mut prefix = vec![];
|
let mut prefix = vec![];
|
||||||
|
|
Loading…
Reference in New Issue