Fix path.toUri for relative paths.

It wasn't preserving trailing slashes, which was a problem when passing
packageRoot URLs to dart2js.

R=rnystrom@google.com

Review URL: https://codereview.chromium.org//1225373003 .
diff --git a/CHANGELOG.md b/CHANGELOG.md
index ea38c19..457be80 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,7 @@
+## 1.3.6
+
+* Ensure that `path.toUri` preserves trailing slashes for relative paths.
+
 ## 1.3.5
 
 * Added type annotations to top-level and static fields.
diff --git a/lib/src/internal_style.dart b/lib/src/internal_style.dart
index db2d346..549f95b 100644
--- a/lib/src/internal_style.dart
+++ b/lib/src/internal_style.dart
@@ -57,8 +57,14 @@
   String pathFromUri(Uri uri);
 
   /// Returns the URI that represents the relative path made of [parts].
-  Uri relativePathToUri(String path) =>
-      new Uri(pathSegments: context.split(path));
+  Uri relativePathToUri(String path) {
+    var segments = context.split(path);
+
+    // Ensure that a trailing slash in the path produces a trailing slash in the
+    // URL.
+    if (isSeparator(path.codeUnitAt(path.length - 1))) segments.add('');
+    return new Uri(pathSegments: segments);
+  }
 
   /// Returns the URI that represents [path], which is assumed to be absolute.
   Uri absolutePathToUri(String path);
diff --git a/pubspec.yaml b/pubspec.yaml
index 835129a..6ba3a15 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -1,5 +1,5 @@
 name: path
-version: 1.3.5
+version: 1.3.6
 author: Dart Team <misc@dartlang.org>
 description: >
  A string-based path manipulation library. All of the path operations you know
diff --git a/test/posix_test.dart b/test/posix_test.dart
index 25e3419..2368d99 100644
--- a/test/posix_test.dart
+++ b/test/posix_test.dart
@@ -499,6 +499,7 @@
   test('toUri', () {
     expect(context.toUri('/path/to/foo'), Uri.parse('file:///path/to/foo'));
     expect(context.toUri('/path/to/foo/'), Uri.parse('file:///path/to/foo/'));
+    expect(context.toUri('path/to/foo/'), Uri.parse('path/to/foo/'));
     expect(context.toUri('/'), Uri.parse('file:///'));
     expect(context.toUri('foo/bar'), Uri.parse('foo/bar'));
     expect(context.toUri('/path/to/foo#bar'),
diff --git a/test/url_test.dart b/test/url_test.dart
index aca161b..854e19a 100644
--- a/test/url_test.dart
+++ b/test/url_test.dart
@@ -721,6 +721,7 @@
         Uri.parse('http://dartlang.org/path/to/foo'));
     expect(context.toUri('http://dartlang.org/path/to/foo/'),
         Uri.parse('http://dartlang.org/path/to/foo/'));
+    expect(context.toUri('path/to/foo/'), Uri.parse('path/to/foo/'));
     expect(
         context.toUri('file:///path/to/foo'), Uri.parse('file:///path/to/foo'));
     expect(context.toUri('foo/bar'), Uri.parse('foo/bar'));
diff --git a/test/windows_test.dart b/test/windows_test.dart
index a174305..6942837 100644
--- a/test/windows_test.dart
+++ b/test/windows_test.dart
@@ -629,6 +629,7 @@
         context.toUri(r'C:\path\to\foo'), Uri.parse('file:///C:/path/to/foo'));
     expect(context.toUri(r'C:\path\to\foo\'),
         Uri.parse('file:///C:/path/to/foo/'));
+    expect(context.toUri(r'path\to\foo\'), Uri.parse('path/to/foo/'));
     expect(context.toUri(r'C:\'), Uri.parse('file:///C:/'));
     expect(context.toUri(r'\\server\share'), Uri.parse('file://server/share'));
     expect(