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

Function TestParseLogFileWithNonCodexTokensOnly

pkg/cli/logs_parsing_test.go:663–688  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

661}
662
663func TestParseLogFileWithNonCodexTokensOnly(t *testing.T) {
664 // Create a temporary log file with only non-Codex token formats
665 tmpDir := testutil.TempDir(t, "test-*")
666 logFile := filepath.Join(tmpDir, "test-generic-tokens.log")
667
668 // Only non-Codex formats - should keep maximum behavior
669 logContent := `tokens: 5000
670token_count: 10000
671input_tokens: 2000`
672
673 err := os.WriteFile(logFile, []byte(logContent), 0644)
674 if err != nil {
675 t.Fatalf("Failed to create test log file: %v", err)
676 }
677
678 // Without aw_info.json and specific engine, should return empty metrics
679 metrics, err := parseLogFileWithEngine(logFile, nil, false, false)
680 if err != nil {
681 t.Fatalf("parseLogFileWithEngine failed: %v", err)
682 }
683
684 // Without engine-specific parsing, should return 0
685 if metrics.TokenUsage != 0 {
686 t.Errorf("Expected token usage 0 (no aw_info.json), got %d", metrics.TokenUsage)
687 }
688}
689
690func TestExtractLogMetricsWithAwOutputFile(t *testing.T) {
691 // Create a temporary directory structure

Callers

nothing calls this directly

Calls 3

TempDirFunction · 0.92
parseLogFileWithEngineFunction · 0.85
ErrorfMethod · 0.45

Tested by

no test coverage detected