changelog shortlog graph tags branches changeset files revisions annotate raw help

Mercurial > core / rust/lib/util/src/tests.rs

changeset 698: 96958d3eb5b0
parent: 0ccbbd142694
author: Richard Westhaver <ellis@rwest.io>
date: Fri, 04 Oct 2024 22:04:59 -0400
permissions: -rw-r--r--
description: fixes
1 //! tests
2 #[test]
3 fn test_related_paths() {
4  use crate::path::local_relative_path;
5  use std::path::Path;
6  local_relative_path(Path::new(".")).unwrap();
7 }
8 
9 #[cfg(feature = "fmt")]
10 #[test]
11 fn test_text_tree() {
12  use crate::fmt::StringTreeNode;
13  let tt = StringTreeNode::with_child_nodes(
14  "Home".to_string(),
15  vec![
16  StringTreeNode::with_child_nodes(
17  "".to_string(),
18  vec![StringTreeNode::with_child_nodes(
19  "Child 2".to_string(),
20  vec![StringTreeNode::with_child_nodes(
21  "Grand Child 2".to_string(),
22  vec![StringTreeNode::with_children(
23  "Great Grand Child 2".to_string(),
24  vec!["Great Great Grand Child 2".to_string()].into_iter(),
25  )]
26  .into_iter(),
27  )]
28  .into_iter(),
29  )]
30  .into_iter(),
31  ),
32  StringTreeNode::with_children(
33  "Posts".to_string(),
34  vec!["Child 3".to_string()].into_iter(),
35  ),
36  ]
37  .into_iter(),
38  );
39 
40  let tt_string = "Home\n+-- \n| '-- Child 2\n| '-- Grand Child 2\n| '-- Great Grand Child 2\n| '-- Great Great Grand Child 2\n'-- Posts\n '-- Child 3\n";
41 
42  assert_eq!(tt.to_string(), tt_string);
43 }