Skip to content

Commit

Permalink
selftest (test linelength) added
Browse files Browse the repository at this point in the history
  • Loading branch information
inkrement committed Jan 1, 2014
1 parent 4aebd34 commit eccf302
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 2 deletions.
3 changes: 2 additions & 1 deletion lib/Messenger/src/peer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ class Peer{

//init
newMessageController = new StreamController<NewMessageEvent>.broadcast();
newConnectionController = new StreamController<NewConnectionEvent>.broadcast();
newConnectionController =
new StreamController<NewConnectionEvent>.broadcast();
_connections = new Map<int, Connection>();

listen_completer = new Completer<String>();
Expand Down
4 changes: 4 additions & 0 deletions tests/helloworld_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ library unittest.helloworld;

import 'package:unittest/unittest.dart';


main() {

group('Simple Unittests to check Framework', () {
Expand All @@ -14,5 +15,8 @@ main() {

expect(hello, "hello world");
});



});
}
6 changes: 6 additions & 0 deletions tests/jsdatachannelconnection_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -219,18 +219,24 @@ void main() {
//each sould receive two messages
alice.newMessageController.stream.listen(
expectAsync1((NewMessageEvent e){
logMessage("alice received message");

expect(e.data.toString(), s);
}, count: 2)
);

bob.newMessageController.stream.listen(
expectAsync1((NewMessageEvent e){
logMessage("bob received message");

expect(e.data.toString(), s);
}, count: 2)
);

clark.newMessageController.stream.listen(
expectAsync1((NewMessageEvent e){
logMessage("clark received message");

expect(e.data.toString(), s);
}, count: 2)
);
Expand Down
30 changes: 30 additions & 0 deletions tests/selftest_test.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import 'package:unittest/unittest.dart';
import 'package:unittest/compact_vm_config.dart';
import 'dart:io';

main(){

useCompactVMConfiguration();

test('max 80 chars per line',(){

Directory libs = new Directory("../lib");

List<FileSystemEntity> l = libs.listSync(recursive: true);

l.forEach((FileSystemEntity i){
if (i is File){
List<String> lines = i.readAsLinesSync();

int ln = 0;

lines.forEach((String l){
ln++;
expect(l.length, lessThan(80), reason:"To long line in file ${i.path} line ${ln}");
});
}
});
});

}

2 changes: 1 addition & 1 deletion tests/unittests.dart
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ void main() {

/// tests for JS Wrapper
group('connection',(){
//js_rtc.main();
js_rtc.main();
});


Expand Down
3 changes: 3 additions & 0 deletions tools/selftest.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh

dart --package-root="../packages" ../tests/selftest_test.dart

0 comments on commit eccf302

Please sign in to comment.