@@ -85,4 +85,39 @@ public async Task DumpText_PlayerData_TextFileCreatedCorrectly()
8585
8686 Assert . AreEqual ( expected , content ) ;
8787 }
88+
89+ [ Test ]
90+ public async Task Analyze_PlayerDataNoTypeTree_ReportsFailureCorrectly ( )
91+ {
92+ // Test for issue #48: Files that fail to process should be counted as failures, not successes
93+ var testDataFolder = Path . Combine ( TestContext . CurrentContext . TestDirectory , "Data" , "PlayerNoTypeTree" ) ;
94+ var databasePath = SQLTestHelper . GetDatabasePath ( m_TestOutputFolder ) ;
95+
96+ using var swOut = new StringWriter ( ) ;
97+ using var swErr = new StringWriter ( ) ;
98+ var currentOut = Console . Out ;
99+ var currentErr = Console . Error ;
100+ try
101+ {
102+ Console . SetOut ( swOut ) ;
103+ Console . SetError ( swErr ) ;
104+
105+ // Analyze should return 0 even if files fail (non-zero would be a critical error)
106+ Assert . AreEqual ( 0 , await Program . Main ( new string [ ] { "analyze" , testDataFolder , "-p" , "level0" } ) ) ;
107+
108+ var output = swOut . ToString ( ) + swErr . ToString ( ) ;
109+
110+ // Check that the filename appears in the error output
111+ Assert . That ( output , Does . Contain ( "level0" ) , "Expected 'level0' to appear in error output" ) ;
112+
113+ // Check that the summary line correctly reports the failure
114+ Assert . That ( output , Does . Contain ( "Failed files: 1" ) , "Expected 'Failed files: 1' in summary" ) ;
115+ Assert . That ( output , Does . Contain ( "Successfully processed files: 0" ) , "Expected 'Successfully processed files: 0' in summary" ) ;
116+ }
117+ finally
118+ {
119+ Console . SetOut ( currentOut ) ;
120+ Console . SetError ( currentErr ) ;
121+ }
122+ }
88123}
0 commit comments