vendor pretty-print dep
This commit is contained in:
parent
4a6c1020f4
commit
52a80cfb0e
40 changed files with 2766 additions and 6 deletions
29
pretty-print/projects/pretty-test/Cargo.toml
Normal file
29
pretty-print/projects/pretty-test/Cargo.toml
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
[package]
|
||||
name = "pretty-test"
|
||||
publish = false
|
||||
version = "0.0.0"
|
||||
authors = ["Aster <192607617@qq.com>"]
|
||||
description = "..."
|
||||
repository = "https://github.com/oovm/sub_projects"
|
||||
documentation = "https://docs.rs/sub_projects"
|
||||
readme = "Readme.md"
|
||||
license = "MPL-2.0"
|
||||
edition = "2021"
|
||||
exclude = ["package.json", "tests/**"]
|
||||
|
||||
[dependencies]
|
||||
pretty = "0.12.1"
|
||||
|
||||
[dependencies.pretty-print]
|
||||
version = "*"
|
||||
default-features = false
|
||||
features = ["std"]
|
||||
path = "../pretty-print"
|
||||
|
||||
[dev-dependencies]
|
||||
|
||||
[features]
|
||||
default = []
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
all-features = true
|
||||
6
pretty-print/projects/pretty-test/package.json
Normal file
6
pretty-print/projects/pretty-test/package.json
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"p": "cargo publish --allow-dirty"
|
||||
}
|
||||
}
|
||||
2
pretty-print/projects/pretty-test/readme.md
Normal file
2
pretty-print/projects/pretty-test/readme.md
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
Title
|
||||
=====
|
||||
1
pretty-print/projects/pretty-test/src/errors.rs
Normal file
1
pretty-print/projects/pretty-test/src/errors.rs
Normal file
|
|
@ -0,0 +1 @@
|
|||
|
||||
5
pretty-print/projects/pretty-test/src/lib.rs
Normal file
5
pretty-print/projects/pretty-test/src/lib.rs
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
#![deny(missing_debug_implementations, missing_copy_implementations)]
|
||||
#![warn(missing_docs, rustdoc::missing_crate_level_docs)]
|
||||
#![doc = include_str!("../readme.md")]
|
||||
#![doc(html_logo_url = "https://raw.githubusercontent.com/oovm/shape-rs/dev/projects/images/Trapezohedron.svg")]
|
||||
#![doc(html_favicon_url = "https://raw.githubusercontent.com/oovm/shape-rs/dev/projects/images/Trapezohedron.svg")]
|
||||
46
pretty-print/projects/pretty-test/tests/main.rs
Normal file
46
pretty-print/projects/pretty-test/tests/main.rs
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
#![allow(dead_code, unused)]
|
||||
use pretty_print::{AnsiColor, AnsiStyle, PrettyBuilder, PrettyTree};
|
||||
use std::{io::stdout, rc::Rc};
|
||||
|
||||
#[test]
|
||||
fn ready() {
|
||||
println!("it works!")
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn box1() {
|
||||
let doc = PrettyTree::text("hello")
|
||||
.annotate(Rc::new(AnsiStyle::new(AnsiColor::Red)))
|
||||
.append(PrettyTree::Hardline)
|
||||
.append("the")
|
||||
.append("∷")
|
||||
.append("world");
|
||||
let mut buffer = vec![];
|
||||
doc.render_colored(10, &mut buffer).unwrap();
|
||||
|
||||
println!("{}", String::from_utf8_lossy(&buffer));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn box2() {
|
||||
let doc = PrettyTree::join(vec!["hello", " ", " ", "world"], "∷").group();
|
||||
let mut buffer = vec![];
|
||||
doc.render_colored(10, &mut buffer).unwrap();
|
||||
|
||||
println!("{}", String::from_utf8_lossy(&buffer));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn box_doc_inference() {
|
||||
let doc = PrettyTree::text("test").append(PrettyTree::line_or_space()).append(PrettyTree::text("test")).group();
|
||||
|
||||
println!("{}", doc.pretty(10));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn newline_in_text() {
|
||||
let doc = PrettyTree::text("test")
|
||||
.append(PrettyTree::line_or_space().append(PrettyTree::text("\"test\n test\"")).nest(4))
|
||||
.group();
|
||||
println!("{}", doc.pretty(10));
|
||||
}
|
||||
5
pretty-print/projects/pretty-test/tests/readme.md
Normal file
5
pretty-print/projects/pretty-test/tests/readme.md
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
## Tests
|
||||
|
||||
```bash
|
||||
wee test
|
||||
```
|
||||
Loading…
Add table
Add a link
Reference in a new issue