(t *testing.T)
| 106 | } |
| 107 | |
| 108 | func TestActionCacheTrailingNewline(t *testing.T) { |
| 109 | // Create temporary directory for testing |
| 110 | tmpDir := testutil.TempDir(t, "test-*") |
| 111 | |
| 112 | // Create and populate cache |
| 113 | cache := NewActionCache(tmpDir) |
| 114 | cache.Set("actions/checkout", "v5", "abc123") |
| 115 | |
| 116 | // Save to disk |
| 117 | err := cache.Save() |
| 118 | if err != nil { |
| 119 | t.Fatalf("Failed to save cache: %v", err) |
| 120 | } |
| 121 | |
| 122 | // Read the file and check for trailing newline |
| 123 | cachePath := filepath.Join(tmpDir, ".github", "aw", CacheFileName) |
| 124 | data, err := os.ReadFile(cachePath) |
| 125 | if err != nil { |
| 126 | t.Fatalf("Failed to read cache file: %v", err) |
| 127 | } |
| 128 | |
| 129 | // Verify file ends with newline (prettier compliance) |
| 130 | if len(data) == 0 || data[len(data)-1] != '\n' { |
| 131 | t.Error("Cache file should end with a trailing newline for prettier compliance") |
| 132 | } |
| 133 | } |
| 134 | |
| 135 | func TestActionCacheSortedEntries(t *testing.T) { |
| 136 | // Create temporary directory for testing |
nothing calls this directly
no test coverage detected