MCPcopy Create free account
hub / github.com/github/gh-aw / TestActionCacheTrailingNewline

Function TestActionCacheTrailingNewline

pkg/workflow/action_cache_test.go:108–133  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

106}
107
108func 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
135func TestActionCacheSortedEntries(t *testing.T) {
136 // Create temporary directory for testing

Callers

nothing calls this directly

Calls 5

SetMethod · 0.95
SaveMethod · 0.95
TempDirFunction · 0.92
NewActionCacheFunction · 0.85
ErrorMethod · 0.45

Tested by

no test coverage detected