Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(133)

Side by Side Diff: tests/lib/mirrors/library_uri_io_test.dart

Issue 16019002: Merge the dart:uri library into dart:core and update the Uri class (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Final cleanup Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 // Test library uri for a library read as a file. 5 // Test library uri for a library read as a file.
6 6
7 library MirrorsTest; 7 library MirrorsTest;
8 8
9 import 'dart:mirrors'; 9 import 'dart:mirrors';
10 import 'dart:io'; 10 import 'dart:io';
11 import 'dart:uri';
12 import '../../../pkg/unittest/lib/unittest.dart'; 11 import '../../../pkg/unittest/lib/unittest.dart';
13 12
14 class Class { 13 class Class {
15 } 14 }
16 15
17 testLibraryUri(var value, Uri expectedUri) { 16 testLibraryUri(var value, Uri expectedUri) {
18 var valueMirror = reflect(value); 17 var valueMirror = reflect(value);
19 ClassMirror valueClass = valueMirror.type; 18 ClassMirror valueClass = valueMirror.type;
20 LibraryMirror valueLibrary = valueClass.owner; 19 LibraryMirror valueLibrary = valueClass.owner;
21 expect(valueLibrary.uri, equals(expectedUri)); 20 expect(valueLibrary.uri, equals(expectedUri));
22 } 21 }
23 22
24 main() { 23 main() {
25 var mirrors = currentMirrorSystem(); 24 var mirrors = currentMirrorSystem();
26 test("Test current library uri", () { 25 test("Test current library uri", () {
27 String appendSlash(String path) => path.endsWith('/') ? path : '$path/'; 26 String appendSlash(String path) => path.endsWith('/') ? path : '$path/';
28 Uri cwd = new Uri.fromComponents( 27 Uri cwd = new Uri(
29 scheme: 'file', 28 scheme: 'file',
30 path: appendSlash(new Path(new File('.').fullPathSync()).toString())); 29 path: appendSlash(new Path(new File('.').fullPathSync()).toString()));
31 Uri uri = cwd.resolve(new Path(new Options().script).toString()); 30 Uri uri = cwd.resolve(new Path(new Options().script).toString());
32 testLibraryUri(new Class(), uri); 31 testLibraryUri(new Class(), uri);
33 }); 32 });
34 } 33 }
OLDNEW
« no previous file with comments | « tests/lib/analyzer/analyze_tests.status ('k') | tests/lib/mirrors/library_uri_package_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698