■ ■ ■ ■ ■ ■
rust/tests/end-to-end_test.rs
| skipped 12 lines |
13 | 13 | | |
14 | 14 | | use super::*; |
15 | 15 | | use assert_cmd::prelude::*; |
| 16 | + | use std::collections::HashMap; |
16 | 17 | | use std::process::Command; |
17 | 18 | | |
18 | 19 | | #[test] |
| skipped 11 lines |
30 | 31 | | let no_color_val = if test.no_color { Some(appendix) } else { None }; |
31 | 32 | | |
32 | 33 | | temp_env::with_vars(vec![("FORCE_COLOR", force_color_val), ("NO_COLOR", no_color_val)], || { |
33 | | - | let output = |
34 | | - | Command::cargo_bin("cfonts").unwrap().args(&test.args).output().expect("failed to execute process"); |
| 34 | + | let rust_output = |
| 35 | + | Command::cargo_bin("cfonts").unwrap().args(&test.args).output().expect("failed to execute rust process"); |
| 36 | + | let mut nodejs_args = test.args.clone(); |
| 37 | + | nodejs_args.insert(0, "../nodejs/bin/index.js".to_string()); |
35 | 38 | | |
36 | | - | assert_eq!(String::from_utf8_lossy(&output.stdout).to_string() + appendix, test.fixture.clone() + appendix); |
| 39 | + | let mut nodejs_env: HashMap<String, String> = HashMap::new(); |
| 40 | + | if !test.force_color.is_empty() { |
| 41 | + | nodejs_env.insert(String::from("FORCE_COLOR"), test.force_color.clone()); |
| 42 | + | } |
| 43 | + | if test.no_color { |
| 44 | + | nodejs_env.insert(String::from("NO_COLOR"), appendix.to_owned()); |
| 45 | + | } |
| 46 | + | let nodejs_output = |
| 47 | + | Command::new("node").envs(nodejs_env).args(nodejs_args).output().expect("failed to execute nodejs process"); |
| 48 | + | |
| 49 | + | assert_eq!( |
| 50 | + | String::from_utf8_lossy(&rust_output.stdout).to_string() + appendix, |
| 51 | + | test.fixture.clone() + appendix |
| 52 | + | ); |
| 53 | + | assert_eq!( |
| 54 | + | String::from_utf8_lossy(&nodejs_output.stdout).to_string() + appendix, |
| 55 | + | test.fixture.clone() + appendix |
| 56 | + | ); |
37 | 57 | | }); |
38 | 58 | | } |
39 | 59 | | } |
| skipped 82 lines |
122 | 142 | | "\n\x1B[49m\n" |
123 | 143 | | ) |
124 | 144 | | .to_string(), |
125 | | - | force_color: String::from(""), |
| 145 | + | force_color: String::from("3"), |
126 | 146 | | no_color: false, |
127 | 147 | | }, |
128 | 148 | | Test { |
| skipped 307 lines |
436 | 456 | | " \x1B[38;2;255;0;0m \x1B[39m\x1B[38;2;255;0;28m \x1B[39m\x1B[38;2;255;0;56m \x1B[39m\x1B[38;2;255;0;84m█\x1B[39m\x1B[38;2;255;0;113m█\x1B[39m\x1B[38;2;255;0;141m║\x1B[39m\x1B[38;2;255;0;170m \x1B[39m\x1B[38;2;255;0;198m \x1B[39m\x1B[38;2;255;0;226m \x1B[39m\x1B[38;2;255;0;255m \x1B[39m\x1B[38;2;226;0;255m█\x1B[39m\x1B[38;2;198;0;255m█\x1B[39m\x1B[38;2;170;0;255m█\x1B[39m\x1B[38;2;141;0;255m█\x1B[39m\x1B[38;2;113;0;255m█\x1B[39m\x1B[38;2;84;0;255m█\x1B[39m\x1B[38;2;56;0;255m█\x1B[39m\x1B[38;2;28;0;255m╗\x1B[39m\x1B[38;2;0;0;255m \x1B[39m\x1B[38;2;0;28;255m█\x1B[39m\x1B[38;2;0;56;255m█\x1B[39m\x1B[38;2;0;85;255m█\x1B[39m\x1B[38;2;0;113;255m█\x1B[39m\x1B[38;2;0;141;255m█\x1B[39m\x1B[38;2;0;169;255m█\x1B[39m\x1B[38;2;0;198;255m█\x1B[39m\x1B[38;2;0;226;255m║\x1B[39m\x1B[38;2;0;255;255m \x1B[39m\x1B[38;2;0;255;226m \x1B[39m\x1B[38;2;0;255;198m \x1B[39m\x1B[38;2;0;255;169m \x1B[39m\x1B[38;2;0;255;141m█\x1B[39m\x1B[38;2;0;255;113m█\x1B[39m\x1B[38;2;0;255;85m║\x1B[39m\x1B[38;2;0;255;56m \x1B[39m\x1B[38;2;0;255;28m \x1B[39m\x1B[38;2;0;255;0m \x1B[39m\n", |
437 | 457 | | " \x1B[38;2;255;0;0m \x1B[39m\x1B[38;2;255;0;28m \x1B[39m\x1B[38;2;255;0;56m \x1B[39m\x1B[38;2;255;0;84m╚\x1B[39m\x1B[38;2;255;0;113m═\x1B[39m\x1B[38;2;255;0;141m╝\x1B[39m\x1B[38;2;255;0;170m \x1B[39m\x1B[38;2;255;0;198m \x1B[39m\x1B[38;2;255;0;226m \x1B[39m\x1B[38;2;255;0;255m \x1B[39m\x1B[38;2;226;0;255m╚\x1B[39m\x1B[38;2;198;0;255m═\x1B[39m\x1B[38;2;170;0;255m═\x1B[39m\x1B[38;2;141;0;255m═\x1B[39m\x1B[38;2;113;0;255m═\x1B[39m\x1B[38;2;84;0;255m═\x1B[39m\x1B[38;2;56;0;255m═\x1B[39m\x1B[38;2;28;0;255m╝\x1B[39m\x1B[38;2;0;0;255m \x1B[39m\x1B[38;2;0;28;255m╚\x1B[39m\x1B[38;2;0;56;255m═\x1B[39m\x1B[38;2;0;85;255m═\x1B[39m\x1B[38;2;0;113;255m═\x1B[39m\x1B[38;2;0;141;255m═\x1B[39m\x1B[38;2;0;169;255m═\x1B[39m\x1B[38;2;0;198;255m═\x1B[39m\x1B[38;2;0;226;255m╝\x1B[39m\x1B[38;2;0;255;255m \x1B[39m\x1B[38;2;0;255;226m \x1B[39m\x1B[38;2;0;255;198m \x1B[39m\x1B[38;2;0;255;169m \x1B[39m\x1B[38;2;0;255;141m╚\x1B[39m\x1B[38;2;0;255;113m═\x1B[39m\x1B[38;2;0;255;85m╝\x1B[39m\x1B[38;2;0;255;56m \x1B[39m\x1B[38;2;0;255;28m \x1B[39m\x1B[38;2;0;255;0m \x1B[39m\n", |
438 | 458 | | "\n\n").to_string(), |
439 | | - | force_color: String::from(""), |
| 459 | + | force_color: String::from("3"), |
440 | 460 | | no_color: false, |
441 | 461 | | }, |
442 | 462 | | Test { |
| skipped 14 lines |
457 | 477 | | " \x1B[38;2;255;0;0m█\x1B[39m\x1B[38;2;255;0;145m█\x1B[39m\x1B[38;2;218;0;255m╔\x1B[39m\x1B[38;2;72;0;255m╝\x1B[39m\x1B[38;2;0;72;255m \x1B[39m\x1B[38;2;0;218;255m█\x1B[39m\x1B[38;2;0;255;145m█\x1B[39m\x1B[38;2;0;255;0m╗\x1B[39m\n", |
458 | 478 | | " \x1B[38;2;255;0;0m╚\x1B[39m\x1B[38;2;255;0;145m═\x1B[39m\x1B[38;2;218;0;255m╝\x1B[39m\x1B[38;2;72;0;255m \x1B[39m\x1B[38;2;0;72;255m \x1B[39m\x1B[38;2;0;218;255m╚\x1B[39m\x1B[38;2;0;255;145m═\x1B[39m\x1B[38;2;0;255;0m╝\x1B[39m\n", |
459 | 479 | | "\n\n").to_string(), |
460 | | - | force_color: String::from(""), |
| 480 | + | force_color: String::from("3"), |
461 | 481 | | no_color: false, |
462 | 482 | | }, |
463 | 483 | | Test { |
| skipped 7 lines |
471 | 491 | | " \x1B[38;2;255;0;0m \x1B[39m\x1B[38;2;255;3;0m \x1B[39m\x1B[38;2;255;7;0m \x1B[39m\x1B[38;2;255;11;0m█\x1B[39m\x1B[38;2;255;15;0m█\x1B[39m\x1B[38;2;255;18;0m║\x1B[39m\x1B[38;2;255;22;0m \x1B[39m\x1B[38;2;255;26;0m \x1B[39m\x1B[38;2;255;30;0m \x1B[39m\x1B[38;2;255;34;0m \x1B[39m\x1B[38;2;255;37;0m█\x1B[39m\x1B[38;2;255;41;0m█\x1B[39m\x1B[38;2;255;45;0m█\x1B[39m\x1B[38;2;255;49;0m█\x1B[39m\x1B[38;2;255;52;0m█\x1B[39m\x1B[38;2;255;56;0m█\x1B[39m\x1B[38;2;255;60;0m█\x1B[39m\x1B[38;2;255;64;0m╗\x1B[39m\x1B[38;2;255;68;0m \x1B[39m\x1B[38;2;255;71;0m█\x1B[39m\x1B[38;2;255;75;0m█\x1B[39m\x1B[38;2;255;79;0m█\x1B[39m\x1B[38;2;255;83;0m█\x1B[39m\x1B[38;2;255;86;0m█\x1B[39m\x1B[38;2;255;90;0m█\x1B[39m\x1B[38;2;255;94;0m█\x1B[39m\x1B[38;2;255;98;0m║\x1B[39m\x1B[38;2;255;102;0m \x1B[39m\x1B[38;2;255;105;0m \x1B[39m\x1B[38;2;255;109;0m \x1B[39m\x1B[38;2;255;113;0m \x1B[39m\x1B[38;2;255;117;0m█\x1B[39m\x1B[38;2;255;120;0m█\x1B[39m\x1B[38;2;255;124;0m║\x1B[39m\x1B[38;2;255;128;0m \x1B[39m\x1B[38;2;255;132;0m \x1B[39m\x1B[38;2;255;136;0m \x1B[39m\n", |
472 | 492 | | " \x1B[38;2;255;0;0m \x1B[39m\x1B[38;2;255;3;0m \x1B[39m\x1B[38;2;255;7;0m \x1B[39m\x1B[38;2;255;11;0m╚\x1B[39m\x1B[38;2;255;15;0m═\x1B[39m\x1B[38;2;255;18;0m╝\x1B[39m\x1B[38;2;255;22;0m \x1B[39m\x1B[38;2;255;26;0m \x1B[39m\x1B[38;2;255;30;0m \x1B[39m\x1B[38;2;255;34;0m \x1B[39m\x1B[38;2;255;37;0m╚\x1B[39m\x1B[38;2;255;41;0m═\x1B[39m\x1B[38;2;255;45;0m═\x1B[39m\x1B[38;2;255;49;0m═\x1B[39m\x1B[38;2;255;52;0m═\x1B[39m\x1B[38;2;255;56;0m═\x1B[39m\x1B[38;2;255;60;0m═\x1B[39m\x1B[38;2;255;64;0m╝\x1B[39m\x1B[38;2;255;68;0m \x1B[39m\x1B[38;2;255;71;0m╚\x1B[39m\x1B[38;2;255;75;0m═\x1B[39m\x1B[38;2;255;79;0m═\x1B[39m\x1B[38;2;255;83;0m═\x1B[39m\x1B[38;2;255;86;0m═\x1B[39m\x1B[38;2;255;90;0m═\x1B[39m\x1B[38;2;255;94;0m═\x1B[39m\x1B[38;2;255;98;0m╝\x1B[39m\x1B[38;2;255;102;0m \x1B[39m\x1B[38;2;255;105;0m \x1B[39m\x1B[38;2;255;109;0m \x1B[39m\x1B[38;2;255;113;0m \x1B[39m\x1B[38;2;255;117;0m╚\x1B[39m\x1B[38;2;255;120;0m═\x1B[39m\x1B[38;2;255;124;0m╝\x1B[39m\x1B[38;2;255;128;0m \x1B[39m\x1B[38;2;255;132;0m \x1B[39m\x1B[38;2;255;136;0m \x1B[39m\n", |
473 | 493 | | "\n\n").to_string(), |
474 | | - | force_color: String::from(""), |
| 494 | + | force_color: String::from("3"), |
475 | 495 | | no_color: false, |
476 | 496 | | }, |
477 | 497 | | Test { |
| skipped 7 lines |
485 | 505 | | " \x1B[38;2;255;0;0m \x1B[39m\x1B[38;2;255;15;0m \x1B[39m\x1B[38;2;255;30;0m \x1B[39m\x1B[38;2;255;45;0m█\x1B[39m\x1B[38;2;255;60;0m█\x1B[39m\x1B[38;2;255;75;0m║\x1B[39m\x1B[38;2;255;90;0m \x1B[39m\x1B[38;2;255;105;0m \x1B[39m\x1B[38;2;255;120;0m \x1B[39m\x1B[38;2;255;136;0m \x1B[39m\x1B[38;2;226;120;28m█\x1B[39m\x1B[38;2;198;105;56m█\x1B[39m\x1B[38;2;170;90;85m█\x1B[39m\x1B[38;2;141;75;113m█\x1B[39m\x1B[38;2;113;60;141m█\x1B[39m\x1B[38;2;85;45;170m█\x1B[39m\x1B[38;2;56;30;198m█\x1B[39m\x1B[38;2;28;15;226m╗\x1B[39m\x1B[38;2;0;0;255m \x1B[39m\x1B[38;2;28;0;226m█\x1B[39m\x1B[38;2;56;0;198m█\x1B[39m\x1B[38;2;85;0;170m█\x1B[39m\x1B[38;2;113;0;141m█\x1B[39m\x1B[38;2;141;0;113m█\x1B[39m\x1B[38;2;170;0;85m█\x1B[39m\x1B[38;2;198;0;56m█\x1B[39m\x1B[38;2;226;0;28m║\x1B[39m\x1B[38;2;255;0;0m \x1B[39m\x1B[38;2;255;0;0m \x1B[39m\x1B[38;2;255;0;0m \x1B[39m\x1B[38;2;255;0;0m \x1B[39m\x1B[38;2;255;0;0m█\x1B[39m\x1B[38;2;255;0;0m█\x1B[39m\x1B[38;2;255;0;0m║\x1B[39m\x1B[38;2;255;0;0m \x1B[39m\x1B[38;2;255;0;0m \x1B[39m\x1B[38;2;255;0;0m \x1B[39m\n", |
486 | 506 | | " \x1B[38;2;255;0;0m \x1B[39m\x1B[38;2;255;15;0m \x1B[39m\x1B[38;2;255;30;0m \x1B[39m\x1B[38;2;255;45;0m╚\x1B[39m\x1B[38;2;255;60;0m═\x1B[39m\x1B[38;2;255;75;0m╝\x1B[39m\x1B[38;2;255;90;0m \x1B[39m\x1B[38;2;255;105;0m \x1B[39m\x1B[38;2;255;120;0m \x1B[39m\x1B[38;2;255;136;0m \x1B[39m\x1B[38;2;226;120;28m╚\x1B[39m\x1B[38;2;198;105;56m═\x1B[39m\x1B[38;2;170;90;85m═\x1B[39m\x1B[38;2;141;75;113m═\x1B[39m\x1B[38;2;113;60;141m═\x1B[39m\x1B[38;2;85;45;170m═\x1B[39m\x1B[38;2;56;30;198m═\x1B[39m\x1B[38;2;28;15;226m╝\x1B[39m\x1B[38;2;0;0;255m \x1B[39m\x1B[38;2;28;0;226m╚\x1B[39m\x1B[38;2;56;0;198m═\x1B[39m\x1B[38;2;85;0;170m═\x1B[39m\x1B[38;2;113;0;141m═\x1B[39m\x1B[38;2;141;0;113m═\x1B[39m\x1B[38;2;170;0;85m═\x1B[39m\x1B[38;2;198;0;56m═\x1B[39m\x1B[38;2;226;0;28m╝\x1B[39m\x1B[38;2;255;0;0m \x1B[39m\x1B[38;2;255;0;0m \x1B[39m\x1B[38;2;255;0;0m \x1B[39m\x1B[38;2;255;0;0m \x1B[39m\x1B[38;2;255;0;0m╚\x1B[39m\x1B[38;2;255;0;0m═\x1B[39m\x1B[38;2;255;0;0m╝\x1B[39m\x1B[38;2;255;0;0m \x1B[39m\x1B[38;2;255;0;0m \x1B[39m\x1B[38;2;255;0;0m \x1B[39m\n", |
487 | 507 | | "\n\n").to_string(), |
488 | | - | force_color: String::from(""), |
| 508 | + | force_color: String::from("3"), |
489 | 509 | | no_color: false, |
490 | 510 | | }, |
491 | 511 | | Test { |
| skipped 1441 lines |