| 105 | } |
| 106 | |
| 107 | func TestCCache_Generate(t *testing.T) { |
| 108 | var builder strings.Builder |
| 109 | ccache := CCache{} |
| 110 | |
| 111 | if err := ccache.Generate(&builder); err != nil { |
| 112 | t.Fatalf("Generate() error = %v", err) |
| 113 | } |
| 114 | |
| 115 | out := builder.String() |
| 116 | if !strings.Contains(out, "# CCache.") { |
| 117 | t.Errorf("output should contain # CCache., got:\n%s", out) |
| 118 | } |
| 119 | if !strings.Contains(out, "CMAKE_C_COMPILER_LAUNCHER") { |
| 120 | t.Errorf("output should set CMAKE_C_COMPILER_LAUNCHER, got:\n%s", out) |
| 121 | } |
| 122 | if !strings.Contains(out, "CMAKE_CXX_COMPILER_LAUNCHER") { |
| 123 | t.Errorf("output should set CMAKE_CXX_COMPILER_LAUNCHER, got:\n%s", out) |
| 124 | } |
| 125 | if !strings.Contains(out, "ccache") { |
| 126 | t.Errorf("output should contain ccache, got:\n%s", out) |
| 127 | } |
| 128 | } |