basic.rs 1.2 KB

123456789101112131415161718192021222324252627282930313233343536
  1. extern crate exa;
  2. use exa::Exa;
  3. /// ---------------------------------------------------------------------------
  4. /// These tests assume that the ‘generate annoying testcases’ script has been
  5. /// run first. Otherwise, they will break!
  6. /// ---------------------------------------------------------------------------
  7. static DIRECTORIES: &'static str = concat!(
  8. "\x1B[1;34m", "attributes", "\x1B[0m", '\n',
  9. "\x1B[1;34m", "links", "\x1B[0m", '\n',
  10. "\x1B[1;34m", "passwd", "\x1B[0m", '\n',
  11. "\x1B[1;34m", "permissions", "\x1B[0m", '\n',
  12. );
  13. #[test]
  14. fn directories() {
  15. let mut output = Vec::<u8>::new();
  16. Exa::new( &[ "-1", "testcases" ], &mut output).unwrap().run().unwrap();
  17. assert_eq!(output, DIRECTORIES.as_bytes());
  18. }
  19. static PERMISSIONS: &'static str = concat!(
  20. "\x1B[1;32m", "all-permissions", "\x1B[0m", '\n',
  21. "\x1B[1;34m", "forbidden-directory", "\x1B[0m", '\n',
  22. "no-permissions", '\n',
  23. );
  24. #[test]
  25. fn permissions() {
  26. let mut output = Vec::<u8>::new();
  27. Exa::new( &[ "-1", "testcases/permissions" ], &mut output).unwrap().run().unwrap();
  28. assert_eq!(output, PERMISSIONS.as_bytes());
  29. }