summaryrefslogtreecommitdiff
path: root/vendor/bandit/specs/reporters/colorizer.spec.cpp
blob: 7708ec81a4cb441fc16ee0a288bf520f40211f4c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#ifndef _WIN32
#include <specs/specs.h>

go_bandit([](){

  describe("colorizer: ", [&](){
  
    describe("colors enabled", [&](){
      bandit::detail::colorizer colorizer;
    
      it("can set color to green", [&](){
        AssertThat(colorizer.green(), Equals("\033[1;32m"));
      });

      it("set color to red", [&](){
        AssertThat(colorizer.red(), Equals("\033[1;31m"));
      });
      it("resets color", [&](){
        AssertThat(colorizer.reset(), Equals("\033[0m"));
      });
    
    });

    describe("colors disabled", [&](){
    
      bandit::detail::colorizer colorizer(false);

      it("ignores setting color to green", [&](){
        AssertThat(colorizer.green(), Equals(""));
      });

      it("ignores setting color to red", [&](){
        AssertThat(colorizer.red(), Equals(""));
      });

      it("ignores resetting colors", [&](){
        AssertThat(colorizer.reset(), Equals(""));
      });
    
    });
  
  });

});
#endif