| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 /// Helper methods for converting a [Mirror] to a [String]. | 5 /// Helper methods for converting a [Mirror] to a [String]. |
| 6 library test.stringify; | 6 library test.stringify; |
| 7 | 7 |
| 8 import 'dart:mirrors'; | 8 import 'dart:mirrors'; |
| 9 | 9 |
| 10 import 'package:expect/expect.dart'; | 10 import 'package:expect/expect.dart'; |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 if (value is ParameterMirror) return stringifyParameter(value); | 96 if (value is ParameterMirror) return stringifyParameter(value); |
| 97 if (value is VariableMirror) return stringifyVariable(value); | 97 if (value is VariableMirror) return stringifyVariable(value); |
| 98 if (value is MethodMirror) return stringifyMethod(value); | 98 if (value is MethodMirror) return stringifyMethod(value); |
| 99 if (value is Symbol) return stringifySymbol(value); | 99 if (value is Symbol) return stringifySymbol(value); |
| 100 if (value is TypeMirror) return stringifyType(value); | 100 if (value is TypeMirror) return stringifyType(value); |
| 101 if (value == null) return '<null>'; | 101 if (value == null) return '<null>'; |
| 102 throw 'Unexpected value: $value'; | 102 throw 'Unexpected value: $value'; |
| 103 } | 103 } |
| 104 | 104 |
| 105 expect(expected, actual) => Expect.stringEquals(expected, stringify(actual)); | 105 expect(expected, actual) => Expect.stringEquals(expected, stringify(actual)); |
| 106 |
| 107 compareSymbols(Symbol a, Symbol b) { |
| 108 return MirrorSystem.getName(a).compareTo(MirrorSystem.getName(b)); |
| 109 } |
| OLD | NEW |