02a8ba9c18
Stopping a test shuts down the control socket, so iperf_run_client() returns -1 with "unable to send control message ... Broken pipe". That is the expected consequence of the stop, not a fault, but the bridge read the negative return as a failure — so pressing STOP left the UI showing "Error (exit 1)" above a broken-pipe message. The bridge now consults its own g_stop flag before classifying the outcome, and the distinction travels up as Iperf3Result.stopped so the status line can say "Stopped". A stop is reported with exit code 0: the run ended the way the user asked it to. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
26 lines
751 B
Dart
26 lines
751 B
Dart
import 'package:flutter_test/flutter_test.dart';
|
|
import 'package:iperf3gui/domain/models/iperf3_result.dart';
|
|
|
|
void main() {
|
|
group('Iperf3Result', () {
|
|
test('can be instantiated with raw output', () {
|
|
const result = Iperf3Result(
|
|
rawOutput: 'Test complete',
|
|
exitCode: 0,
|
|
);
|
|
expect(result.rawOutput, equals('Test complete'));
|
|
expect(result.exitCode, equals(0));
|
|
});
|
|
|
|
test('stopped defaults to false', () {
|
|
const result = Iperf3Result(rawOutput: 'x', exitCode: 0);
|
|
expect(result.stopped, isFalse);
|
|
});
|
|
|
|
test('stopped is preserved when set', () {
|
|
const result = Iperf3Result(rawOutput: 'x', exitCode: 0, stopped: true);
|
|
expect(result.stopped, isTrue);
|
|
});
|
|
});
|
|
}
|