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

Unified Diff: pkg/analyzer/test/generated/java_io_test.dart

Issue 479593002: Test for JavaFile.toURI(). (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/analyzer/lib/src/generated/java_io.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/test/generated/java_io_test.dart
diff --git a/pkg/analyzer/test/generated/java_io_test.dart b/pkg/analyzer/test/generated/java_io_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..7af55eb151d576eaff1c4de107b6ec4786d61519
--- /dev/null
+++ b/pkg/analyzer/test/generated/java_io_test.dart
@@ -0,0 +1,52 @@
+// Copyright (c) 2014, 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.
+
+// This code was auto-generated, is not intended to be edited, and is subject to
+// significant change. Please see the README file for more information.
+
+library engine.java_io_test;
+
+import 'package:analyzer/src/generated/java_io.dart';
+import 'package:unittest/unittest.dart';
+import 'package:path/path.dart';
+import 'dart:io';
+
+main() {
+ group('JavaFile', () {
+ group('toURI', () {
+ test('forAbsolute', () {
+ var tempDir = Directory.systemTemp.createTempSync('java_io_test');
+ try {
+ String tempPath = normalize(absolute(tempDir.path));
+ String path = join(tempPath, 'foo.dart');
+ // we use an absolute path
+ expect(isAbsolute(path), isTrue);
+ // test that toURI() returns an absolute URI
+ Uri uri = new JavaFile(path).toURI();
+ expect(uri.isAbsolute, isTrue);
+ expect(uri.scheme, 'file');
+ } finally {
+ tempDir.deleteSync(recursive: true);
+ }
+ });
+ test('forRelative', () {
+ var tempDir = Directory.systemTemp.createTempSync('java_io_test');
+ try {
+ String tempPath = normalize(absolute(tempDir.path));
+ String path = join(tempPath, 'foo.dart');
+ expect(isAbsolute(path), isTrue);
+ // prepare a relative path
+ String relPath = relative(path);
+ expect(isAbsolute(relPath), isFalse);
+ // test that toURI() returns an absolute URI
+ Uri uri = new JavaFile(relPath).toURI();
+ expect(uri.isAbsolute, isTrue);
+ expect(uri.scheme, 'file');
+ } finally {
+ tempDir.deleteSync(recursive: true);
+ }
+ });
+ });
+ });
+}
« no previous file with comments | « pkg/analyzer/lib/src/generated/java_io.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698