Commit 61329c2 1 parent e44a3eb commit 61329c2 Copy full SHA for 61329c2
File tree 2 files changed +29
-3
lines changed
2 files changed +29
-3
lines changed Original file line number Diff line number Diff line change @@ -79,9 +79,11 @@ class PathSource extends Source {
79
79
return PackageRef (
80
80
name,
81
81
PathDescription (
82
- p.normalize (
83
- p.join (p.absolute (containingDescription.path), description),
84
- ),
82
+ isRelative
83
+ ? p.normalize (
84
+ p.join (p.absolute (containingDescription.path), description),
85
+ )
86
+ : description,
85
87
isRelative,
86
88
),
87
89
);
Original file line number Diff line number Diff line change 2
2
// for details. All rights reserved. Use of this source code is governed by a
3
3
// BSD-style license that can be found in the LICENSE file.
4
4
5
+ import 'dart:convert' ;
5
6
import 'dart:io' show File;
6
7
7
8
import 'package:path/path.dart' as p;
8
9
import 'package:pub/src/exit_codes.dart' as exit_codes;
9
10
import 'package:test/test.dart' ;
11
+ import 'package:test_descriptor/test_descriptor.dart' ;
10
12
import 'package:yaml/yaml.dart' ;
11
13
12
14
import '../../descriptor.dart' as d;
@@ -1182,4 +1184,26 @@ dependency_overrides:
1182
1184
server.serve ('foo' , '2.0.0' );
1183
1185
await pubAdd (args: ['foo' , '--offline' ]);
1184
1186
});
1187
+
1188
+ test ('Uses given path for absolute paths' , () async {
1189
+ await d.dir ('foo' , [d.libPubspec ('foo' , '1.0.0' )]).create ();
1190
+
1191
+ await d.appDir (dependencies: {}).create ();
1192
+
1193
+ // Explicitly add using a forward slash in absolute path.
1194
+ // This should be preserved in the pubspec.yaml, even on windows.
1195
+ await pubAdd (
1196
+ args: [
1197
+ 'foo:${json .encode ({'path' : '$sandbox /foo' })}' ,
1198
+ ],
1199
+ );
1200
+
1201
+ await d
1202
+ .appDir (
1203
+ dependencies: {
1204
+ 'foo' : {'path' : '$sandbox /foo' },
1205
+ },
1206
+ )
1207
+ .validate ();
1208
+ });
1185
1209
}
You can’t perform that action at this time.
0 commit comments