luaur-reduce-cli 0.1.0

Command-line Luau test-case reducer (Rust).
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use alloc::string::String;

use crate::records::reducer::Reducer;

pub fn reducer_escape(this: &Reducer, s: &str) -> String {
    let mut result = String::with_capacity(s.len() + 20);
    result.push('"');

    for c in s.chars() {
        if c == '"' {
            result.push('\\');
        }
        result.push(c);
    }

    result.push('"');
    result
}