#![cfg_attr(not(feature = "std"), no_std)]
extern crate alloc;
#[cfg(not(feature = "std"))]
use alloc::{format, vec, vec::Vec};
#[macro_use]
extern crate pest;
extern crate pest_derive;
#[cfg(feature = "grammar-extras")]
use pest_derive::Parser;
#[derive(Parser)]
#[grammar = "../tests/surround.pest"]
#[cfg(feature = "grammar-extras")]
pub struct SurroundParser;
#[test]
#[cfg(feature = "grammar-extras")]
fn surround_parenthesis() {
parses_to! {
parser: SurroundParser,
input: "(hello world)",
rule: Rule::Quote,
tokens: [
QuoteChars(1, 12)
]
}
}
#[test]
#[cfg(feature = "grammar-extras")]
fn surround_angle_brackets() {
parses_to! {
parser: SurroundParser,
input: "<hello world>",
rule: Rule::Quote,
tokens: [
QuoteChars(1, 12)
]
}
}
#[test]
#[cfg(feature = "grammar-extras")]
fn start_with_one_end_with_other() {
fails_with! {
parser: SurroundParser,
input: "(hello world>",
rule: Rule::Quote,
positives: vec![],
negatives: vec![],
pos: 0
}
}