Merge pull request #12 from dart-lang/tests

add tests, travis support, some lints
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000..9c3a39f
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,2 @@
+language: dart
+script: ./tool/travis.sh
diff --git a/analysis_options.yaml b/analysis_options.yaml
index cee7122..5f425e0 100644
--- a/analysis_options.yaml
+++ b/analysis_options.yaml
@@ -2,4 +2,6 @@
   strong-mode: true
 linter:
   rules:
+    - always_declare_return_types
     - directives_ordering
+    - public_member_api_docs
diff --git a/lib/test_reflective_loader.dart b/lib/test_reflective_loader.dart
index 9ebaf84..fa0d91d 100644
--- a/lib/test_reflective_loader.dart
+++ b/lib/test_reflective_loader.dart
@@ -27,7 +27,7 @@
  * A marker annotation used to instruct dart2js to keep reflection information
  * for the annotated classes.
  */
-const ReflectiveTest reflectiveTest = const ReflectiveTest();
+const _ReflectiveTest reflectiveTest = const _ReflectiveTest();
 
 /**
  * A marker annotation used to annotate "solo" groups and tests.
@@ -92,7 +92,7 @@
 void defineReflectiveTests(Type type) {
   ClassMirror classMirror = reflectClass(type);
   if (!classMirror.metadata.any((InstanceMirror annotation) =>
-      annotation.type.reflectedType == ReflectiveTest)) {
+      annotation.type.reflectedType == _ReflectiveTest)) {
     String name = MirrorSystem.getName(classMirror.qualifiedName);
     throw new Exception('Class $name must have annotation "@reflectiveTest" '
         'in order to be run by runReflectiveTests.');
@@ -247,21 +247,21 @@
   });
 }
 
-_runTest(ClassMirror classMirror, Symbol symbol) {
+Future _runTest(ClassMirror classMirror, Symbol symbol) {
   InstanceMirror instanceMirror = classMirror.newInstance(new Symbol(''), []);
   return _invokeSymbolIfExists(instanceMirror, #setUp)
       .then((_) => instanceMirror.invoke(symbol, []).reflectee)
       .whenComplete(() => _invokeSymbolIfExists(instanceMirror, #tearDown));
 }
 
-typedef _TestFunction();
+typedef dynamic _TestFunction();
 
 /**
  * A marker annotation used to instruct dart2js to keep reflection information
  * for the annotated classes.
  */
-class ReflectiveTest {
-  const ReflectiveTest();
+class _ReflectiveTest {
+  const _ReflectiveTest();
 }
 
 /**
diff --git a/test/test_reflective_loader_test.dart b/test/test_reflective_loader_test.dart
new file mode 100644
index 0000000..952fe0a
--- /dev/null
+++ b/test/test_reflective_loader_test.dart
@@ -0,0 +1,38 @@
+// Copyright (c) 2017, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'dart:async';
+
+import 'package:test/test.dart';
+import 'package:test_reflective_loader/test_reflective_loader.dart';
+
+void main() {
+  defineReflectiveSuite(() {
+    defineReflectiveTests(TestReflectiveLoaderTest);
+  });
+}
+
+@reflectiveTest
+class TestReflectiveLoaderTest {
+  String pathname;
+
+  void test_passes() {
+    expect(true, true);
+  }
+
+  @failingTest
+  void test_fails() {
+    expect(false, true);
+  }
+
+  @failingTest
+  void test_fails_throws_sync() {
+    throw 'foo';
+  }
+
+  @failingTest
+  Future test_fails_throws_async() {
+    return new Future.error('foo');
+  }
+}
diff --git a/tool/travis.sh b/tool/travis.sh
new file mode 100755
index 0000000..ea0f1c4
--- /dev/null
+++ b/tool/travis.sh
@@ -0,0 +1,16 @@
+#!/bin/bash
+
+# Copyright (c) 2017, the Dart project authors.  Please see the AUTHORS file
+# for details. All rights reserved. Use of this source code is governed by a
+# BSD-style license that can be found in the LICENSE file.
+
+# Fast fail the script on failures.   
+set -e
+
+# Verify that the libraries are error free.
+dartanalyzer --fatal-warnings \
+  lib/test_reflective_loader.dart \
+  test/test_reflective_loader_test.dart
+
+# Run the tests.
+dart test/test_reflective_loader_test.dart