@@ -11,194 +11,194 @@ fn main() -> Result<()> {
1111 run_cli ( env:: args ( ) . collect ( ) )
1212}
1313
14- #[ cfg( all( test, feature = "cli" ) ) ]
15- mod tests {
16- use std:: sync:: OnceLock ;
17-
18- use assert_cmd:: assert:: OutputAssertExt ;
19- use predicates:: prelude:: * ;
20- use serial_test:: serial;
21-
22- // 빌드를 한 번만 수행하고 재사용
23- static BUILT_BINARY : OnceLock < escargot:: CargoRun > = OnceLock :: new ( ) ;
24-
25- fn get_built_binary ( ) -> & ' static escargot:: CargoRun {
26- BUILT_BINARY . get_or_init ( || {
27- escargot:: CargoBuild :: new ( )
28- . bin ( "braillify" )
29- . current_release ( )
30- . current_target ( )
31- . run ( )
32- . expect ( "Failed to build braillify binary for testing" )
33- } )
34- }
35-
36- // // assert_cmd를 사용한 통합 테스트들
37- // #[test]
38- // #[serial]
39- // fn test_braillify_integration_single_word() {
40- // let mut cmd = get_built_binary().command();
41- // cmd.arg("안녕");
42- // let assert = cmd
43- // .assert()
44- // .success()
45- // .stdout(predicate::str::is_empty().not());
46-
47- // // 점자 유니코드가 포함되어 있는지 확인
48- // let stdout = String::from_utf8_lossy(&assert.get_output().stdout);
49- // assert!(
50- // stdout
51- // .chars()
52- // .any(|c| c as u32 >= 0x2800 && c as u32 <= 0x28FF)
53- // );
54- // }
55-
56- // #[test]
57- // #[serial]
58- // fn test_braillify_integration_english() {
59- // let mut cmd = get_built_binary().command();
60- // cmd.arg("hello");
61- // cmd.assert()
62- // .success()
63- // .stdout(predicate::str::is_empty().not());
64- // }
65-
66- // #[test]
67- // #[serial]
68- // fn test_braillify_integration_mixed() {
69- // let mut cmd = get_built_binary().command();
70- // cmd.arg("안녕 hello");
71- // cmd.assert()
72- // .success()
73- // .stdout(predicate::str::is_empty().not());
74- // }
75-
76- // #[test]
77- // #[serial]
78- // fn test_braillify_integration_numbers() {
79- // let mut cmd = get_built_binary().command();
80- // cmd.arg("123");
81- // cmd.assert()
82- // .success()
83- // .stdout(predicate::str::is_empty().not());
84- // }
85-
86- // #[test]
87- // #[serial]
88- // fn test_braillify_pipe_input() {
89- // let mut cmd = get_built_binary().command();
90- // let mut child = cmd
91- // .stdin(std::process::Stdio::piped())
92- // .stdout(std::process::Stdio::piped())
93- // .spawn()
94- // .unwrap();
95- // {
96- // let stdin = child.stdin.as_mut().unwrap();
97- // stdin.write_all("안녕\n".as_bytes()).unwrap();
98- // }
99- // let output = child.wait_with_output().unwrap();
100- // assert!(output.status.success());
101- // assert!(!output.stdout.is_empty());
102- // }
103-
104- // #[test]
105- // #[serial]
106- // fn test_braillify_help() {
107- // let mut cmd = get_built_binary().command();
108- // cmd.arg("--help");
109- // cmd.assert()
110- // .success()
111- // .stdout(predicate::str::contains("한국어 점자 변환 CLI"));
112- // }
113-
114- // #[test]
115- // #[serial]
116- // fn test_braillify_version() {
117- // let mut cmd = get_built_binary().command();
118- // cmd.arg("--version");
119- // cmd.assert()
120- // .success()
121- // .stdout(predicate::str::contains("braillify"));
122- // }
123-
124- // #[test]
125- // #[serial]
126- // fn test_braillify_no_args() {
127- // let mut cmd = get_built_binary().command();
128- // // 인자 없이 실행하면 REPL 모드로 진입
129- // let mut child = cmd
130- // .stdin(std::process::Stdio::piped())
131- // .stdout(std::process::Stdio::piped())
132- // .spawn()
133- // .unwrap();
134- // {
135- // let stdin = child.stdin.as_mut().unwrap();
136- // stdin.write_all("안녕\n".as_bytes()).unwrap();
137- // }
138- // let output = child.wait_with_output().unwrap();
139- // assert!(output.status.success());
140- // assert!(!output.stdout.is_empty());
141- // cmd.assert()
142- // .success()
143- // .stdout(predicate::str::contains("braillify REPL"));
144- // }
145-
146- // #[test]
147- // #[serial]
148- // fn test_braillify_empty_input() {
149- // let mut cmd = get_built_binary().command();
150- // cmd.arg("");
151- // cmd.assert().success().stdout(predicate::str::is_empty());
152- // }
153-
154- // #[test]
155- // #[serial]
156- // fn test_braillify_long_text() {
157- // let long_text = "안녕하세요 ".repeat(100);
158- // let mut cmd = get_built_binary().command();
159- // cmd.arg(&long_text);
160- // cmd.assert()
161- // .success()
162- // .stdout(predicate::str::is_empty().not());
163- // }
164-
165- // #[test]
166- // #[serial]
167- // fn test_braillify_special_characters() {
168- // let mut cmd = get_built_binary().command();
169- // cmd.arg("!@#$%^&*()");
170- // cmd.assert()
171- // .failure()
172- // .stderr(predicate::str::contains("Invalid character"));
173- // }
174-
175- // #[test]
176- // #[serial]
177- // fn test_braillify_korean_sentences() {
178- // let mut cmd = get_built_binary().command();
179- // cmd.arg("안녕하세요. 오늘 날씨가 좋네요.");
180- // cmd.assert()
181- // .success()
182- // .stdout(predicate::str::is_empty().not());
183- // }
184-
185- // #[test]
186- // #[serial]
187- // fn test_braillify_multiple_spaces() {
188- // let mut cmd = get_built_binary().command();
189- // cmd.arg("안녕 하세요");
190- // cmd.assert()
191- // .success()
192- // .stdout(predicate::str::is_empty().not());
193- // }
194-
195- // #[test]
196- // #[serial]
197- // fn test_braillify_newlines() {
198- // let mut cmd = get_built_binary().command();
199- // cmd.arg("안녕\n하세요");
200- // cmd.assert()
201- // .success()
202- // .stdout(predicate::str::is_empty().not());
203- // }
204- }
14+ // #[cfg(all(test, feature = "cli"))]
15+ // mod tests {
16+ // use std::sync::OnceLock;
17+
18+ // use assert_cmd::assert::OutputAssertExt;
19+ // use predicates::prelude::*;
20+ // use serial_test::serial;
21+
22+ // // 빌드를 한 번만 수행하고 재사용
23+ // static BUILT_BINARY: OnceLock<escargot::CargoRun> = OnceLock::new();
24+
25+ // fn get_built_binary() -> &'static escargot::CargoRun {
26+ // BUILT_BINARY.get_or_init(|| {
27+ // escargot::CargoBuild::new()
28+ // .bin("braillify")
29+ // .current_release()
30+ // .current_target()
31+ // .run()
32+ // .expect("Failed to build braillify binary for testing")
33+ // })
34+ // }
35+
36+ // // // assert_cmd를 사용한 통합 테스트들
37+ // // #[test]
38+ // // #[serial]
39+ // // fn test_braillify_integration_single_word() {
40+ // // let mut cmd = get_built_binary().command();
41+ // // cmd.arg("안녕");
42+ // // let assert = cmd
43+ // // .assert()
44+ // // .success()
45+ // // .stdout(predicate::str::is_empty().not());
46+
47+ // // // 점자 유니코드가 포함되어 있는지 확인
48+ // // let stdout = String::from_utf8_lossy(&assert.get_output().stdout);
49+ // // assert!(
50+ // // stdout
51+ // // .chars()
52+ // // .any(|c| c as u32 >= 0x2800 && c as u32 <= 0x28FF)
53+ // // );
54+ // // }
55+
56+ // // #[test]
57+ // // #[serial]
58+ // // fn test_braillify_integration_english() {
59+ // // let mut cmd = get_built_binary().command();
60+ // // cmd.arg("hello");
61+ // // cmd.assert()
62+ // // .success()
63+ // // .stdout(predicate::str::is_empty().not());
64+ // // }
65+
66+ // // #[test]
67+ // // #[serial]
68+ // // fn test_braillify_integration_mixed() {
69+ // // let mut cmd = get_built_binary().command();
70+ // // cmd.arg("안녕 hello");
71+ // // cmd.assert()
72+ // // .success()
73+ // // .stdout(predicate::str::is_empty().not());
74+ // // }
75+
76+ // // #[test]
77+ // // #[serial]
78+ // // fn test_braillify_integration_numbers() {
79+ // // let mut cmd = get_built_binary().command();
80+ // // cmd.arg("123");
81+ // // cmd.assert()
82+ // // .success()
83+ // // .stdout(predicate::str::is_empty().not());
84+ // // }
85+
86+ // // #[test]
87+ // // #[serial]
88+ // // fn test_braillify_pipe_input() {
89+ // // let mut cmd = get_built_binary().command();
90+ // // let mut child = cmd
91+ // // .stdin(std::process::Stdio::piped())
92+ // // .stdout(std::process::Stdio::piped())
93+ // // .spawn()
94+ // // .unwrap();
95+ // // {
96+ // // let stdin = child.stdin.as_mut().unwrap();
97+ // // stdin.write_all("안녕\n".as_bytes()).unwrap();
98+ // // }
99+ // // let output = child.wait_with_output().unwrap();
100+ // // assert!(output.status.success());
101+ // // assert!(!output.stdout.is_empty());
102+ // // }
103+
104+ // // #[test]
105+ // // #[serial]
106+ // // fn test_braillify_help() {
107+ // // let mut cmd = get_built_binary().command();
108+ // // cmd.arg("--help");
109+ // // cmd.assert()
110+ // // .success()
111+ // // .stdout(predicate::str::contains("한국어 점자 변환 CLI"));
112+ // // }
113+
114+ // // #[test]
115+ // // #[serial]
116+ // // fn test_braillify_version() {
117+ // // let mut cmd = get_built_binary().command();
118+ // // cmd.arg("--version");
119+ // // cmd.assert()
120+ // // .success()
121+ // // .stdout(predicate::str::contains("braillify"));
122+ // // }
123+
124+ // // #[test]
125+ // // #[serial]
126+ // // fn test_braillify_no_args() {
127+ // // let mut cmd = get_built_binary().command();
128+ // // // 인자 없이 실행하면 REPL 모드로 진입
129+ // // let mut child = cmd
130+ // // .stdin(std::process::Stdio::piped())
131+ // // .stdout(std::process::Stdio::piped())
132+ // // .spawn()
133+ // // .unwrap();
134+ // // {
135+ // // let stdin = child.stdin.as_mut().unwrap();
136+ // // stdin.write_all("안녕\n".as_bytes()).unwrap();
137+ // // }
138+ // // let output = child.wait_with_output().unwrap();
139+ // // assert!(output.status.success());
140+ // // assert!(!output.stdout.is_empty());
141+ // // cmd.assert()
142+ // // .success()
143+ // // .stdout(predicate::str::contains("braillify REPL"));
144+ // // }
145+
146+ // // #[test]
147+ // // #[serial]
148+ // // fn test_braillify_empty_input() {
149+ // // let mut cmd = get_built_binary().command();
150+ // // cmd.arg("");
151+ // // cmd.assert().success().stdout(predicate::str::is_empty());
152+ // // }
153+
154+ // // #[test]
155+ // // #[serial]
156+ // // fn test_braillify_long_text() {
157+ // // let long_text = "안녕하세요 ".repeat(100);
158+ // // let mut cmd = get_built_binary().command();
159+ // // cmd.arg(&long_text);
160+ // // cmd.assert()
161+ // // .success()
162+ // // .stdout(predicate::str::is_empty().not());
163+ // // }
164+
165+ // // #[test]
166+ // // #[serial]
167+ // // fn test_braillify_special_characters() {
168+ // // let mut cmd = get_built_binary().command();
169+ // // cmd.arg("!@#$%^&*()");
170+ // // cmd.assert()
171+ // // .failure()
172+ // // .stderr(predicate::str::contains("Invalid character"));
173+ // // }
174+
175+ // // #[test]
176+ // // #[serial]
177+ // // fn test_braillify_korean_sentences() {
178+ // // let mut cmd = get_built_binary().command();
179+ // // cmd.arg("안녕하세요. 오늘 날씨가 좋네요.");
180+ // // cmd.assert()
181+ // // .success()
182+ // // .stdout(predicate::str::is_empty().not());
183+ // // }
184+
185+ // // #[test]
186+ // // #[serial]
187+ // // fn test_braillify_multiple_spaces() {
188+ // // let mut cmd = get_built_binary().command();
189+ // // cmd.arg("안녕 하세요");
190+ // // cmd.assert()
191+ // // .success()
192+ // // .stdout(predicate::str::is_empty().not());
193+ // // }
194+
195+ // // #[test]
196+ // // #[serial]
197+ // // fn test_braillify_newlines() {
198+ // // let mut cmd = get_built_binary().command();
199+ // // cmd.arg("안녕\n하세요");
200+ // // cmd.assert()
201+ // // .success()
202+ // // .stdout(predicate::str::is_empty().not());
203+ // // }
204+ // }
0 commit comments