OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 library unittest.runner.parse_metadata; | 5 library unittest.runner.parse_metadata; |
6 | 6 |
7 import 'dart:io'; | 7 import 'dart:io'; |
8 | 8 |
9 import 'package:analyzer/analyzer.dart'; | 9 import 'package:analyzer/analyzer.dart'; |
10 import 'package:analyzer/src/generated/ast.dart'; | 10 import 'package:analyzer/src/generated/ast.dart'; |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 | 92 |
93 if (testOn != null) { | 93 if (testOn != null) { |
94 throw new SourceSpanFormatException( | 94 throw new SourceSpanFormatException( |
95 "Only a single TestOn annotation may be used for a given test file.", | 95 "Only a single TestOn annotation may be used for a given test file.", |
96 _spanFor(annotation, path)); | 96 _spanFor(annotation, path)); |
97 } | 97 } |
98 | 98 |
99 testOn = args.first.stringValue; | 99 testOn = args.first.stringValue; |
100 } | 100 } |
101 | 101 |
102 return new Metadata(testOn); | 102 return new Metadata.parse(testOn: testOn); |
103 } | 103 } |
104 | 104 |
105 /// Creates a [SourceSpan] for [node]. | 105 /// Creates a [SourceSpan] for [node]. |
106 SourceSpan _spanFor(AstNode node, String path) => | 106 SourceSpan _spanFor(AstNode node, String path) => |
107 // Load a SourceFile from scratch here since we're only ever going to emit | 107 // Load a SourceFile from scratch here since we're only ever going to emit |
108 // one error per file anyway. | 108 // one error per file anyway. |
109 new SourceFile(new File(path).readAsStringSync(), url: p.toUri(path)) | 109 new SourceFile(new File(path).readAsStringSync(), url: p.toUri(path)) |
110 .span(node.offset, node.end); | 110 .span(node.offset, node.end); |
OLD | NEW |