feat(build): Add disable_comments option (#1127)

This commit is contained in:
bouzuya
2022-11-08 11:08:19 -05:00
committed by GitHub
parent c9cadd4b23
commit e188521149
10 changed files with 151 additions and 6 deletions
@@ -0,0 +1,15 @@
use std::{fs, path::PathBuf};
#[test]
fn test() {
let path = PathBuf::from(std::env::var("OUT_DIR").unwrap()).join("test.rs");
let s = fs::read_to_string(path).unwrap();
assert!(!s.contains("This comment will be removed."));
let mut count = 0_usize;
let mut index = 0_usize;
while let Some(found) = s[index..].find("This comment will not be removed.") {
index += found + 1;
count += 1;
}
assert_eq!(count, 2 + 3 + 3); // message: 2, client: 3, server: 3
}