-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(ping): ensure it can work cross platform
- Loading branch information
1 parent
0156cc7
commit ed34f14
Showing
1 changed file
with
12 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,21 @@ | ||
import 'dart:io'; | ||
import 'package:test/test.dart'; | ||
import 'package:dexeca/dexeca.dart'; | ||
|
||
void main() { | ||
test('dexeca', () async { | ||
var proc = await dexeca('ping', ['1.1.1.1'], inheritStdio: false); | ||
var proc = | ||
await dexeca('ping', _pingArgs('127.0.0.1'), inheritStdio: false); | ||
expect(proc.exitCode, equals(0)); | ||
expect(proc.stderr, equals('')); | ||
expect(proc.stdout, contains('1.1.1.1')); | ||
expect(proc.stdout, contains('127.0.0.1')); | ||
}); | ||
} | ||
|
||
List<String> _pingArgs(String target) { | ||
if (Platform.isWindows) { | ||
return [target]; | ||
} else { | ||
return ['-c', '4', target]; | ||
} | ||
} |