Test that unrelated annotations does not affect code-gen
diff --git a/pkgs/shelf_router_generator/test/server/service.dart b/pkgs/shelf_router_generator/test/server/service.dart
index 1803972..21b18ab 100644
--- a/pkgs/shelf_router_generator/test/server/service.dart
+++ b/pkgs/shelf_router_generator/test/server/service.dart
@@ -16,6 +16,7 @@
import 'package:shelf/shelf.dart';
import 'package:shelf_router/shelf_router.dart';
import 'api.dart';
+import 'unrelatedannotation.dart';
part 'service.g.dart';
@@ -51,3 +52,10 @@
Router get router => _$ServiceRouter(this);
}
+
+class UnrelatedThing {
+ @EndPoint.put('/api/test')
+ Future<Response> unrelatedMethod(Request request) async {
+ return Response.ok('hello world');
+ }
+}
diff --git a/pkgs/shelf_router_generator/test/server/unrelatedannotation.dart b/pkgs/shelf_router_generator/test/server/unrelatedannotation.dart
new file mode 100644
index 0000000..017afa6
--- /dev/null
+++ b/pkgs/shelf_router_generator/test/server/unrelatedannotation.dart
@@ -0,0 +1,36 @@
+/// Annotation for an API end-point.
+class EndPoint {
+ /// HTTP verb for requests routed to the annotated method.
+ final String verb;
+
+ /// HTTP route for request routed to the annotated method.
+ final String route;
+
+ /// Create an annotation that routes requests matching [verb] and [route] to
+ /// the annotated method.
+ const EndPoint(this.verb, this.route);
+
+ /// Route `GET` requests matching [route] to annotated method.
+ const EndPoint.get(this.route) : verb = 'GET';
+
+ /// Route `HEAD` requests matching [route] to annotated method.
+ const EndPoint.head(this.route) : verb = 'HEAD';
+
+ /// Route `POST` requests matching [route] to annotated method.
+ const EndPoint.post(this.route) : verb = 'POST';
+
+ /// Route `PUT` requests matching [route] to annotated method.
+ const EndPoint.put(this.route) : verb = 'PUT';
+
+ /// Route `DELETE` requests matching [route] to annotated method.
+ const EndPoint.delete(this.route) : verb = 'DELETE';
+
+ /// Route `CONNECT` requests matching [route] to annotated method.
+ const EndPoint.connect(this.route) : verb = 'CONNECT';
+
+ /// Route `OPTIONS` requests matching [route] to annotated method.
+ const EndPoint.options(this.route) : verb = 'OPTIONS';
+
+ /// Route `TRACE` requests matching [route] to annotated method.
+ const EndPoint.trace(this.route) : verb = 'TRACE';
+}