@@ -6,7 +6,7 @@ import 'dart:convert';
66import 'dart:io' ;
77
88import 'package:dartdev/src/utils.dart' ;
9- import 'package:path/path.dart' ;
9+ import 'package:path/path.dart' as path ;
1010import 'package:test/test.dart' ;
1111
1212void main () {
@@ -32,7 +32,7 @@ void main() {
3232
3333 test ('nested' , () {
3434 var dir = Directory ('foo' );
35- expect (relativePath (join (dir.absolute.path, 'path' ), dir), 'path' );
35+ expect (relativePath (path. join (dir.absolute.path, 'path' ), dir), 'path' );
3636 });
3737 });
3838
@@ -93,10 +93,10 @@ void main() {
9393 test ('name' , () {
9494 expect (Directory ('' ).name, '' );
9595 expect (Directory ('dirName' ).name, 'dirName' );
96- expect (Directory ('dirName$separator ' ).name, 'dirName' );
96+ expect (Directory ('dirName${ path . separator } ' ).name, 'dirName' );
9797 expect (File ('' ).name, '' );
9898 expect (File ('foo.dart' ).name, 'foo.dart' );
99- expect (File ('${separator }foo.dart' ).name, 'foo.dart' );
99+ expect (File ('${path . separator }foo.dart' ).name, 'foo.dart' );
100100 expect (File ('bar.bart' ).name, 'bar.bart' );
101101 });
102102 });
@@ -133,6 +133,66 @@ void main() {
133133 orderedEquals (['pub' , 'publish' , '--help' ]));
134134 });
135135 });
136+
137+ group ('wrapText' , () {
138+ test ('oneLine_wordLongerThanLine' , () {
139+ expect (wrapText ('http://long-url' , width: 10 ), equals ('http://long-url' ));
140+ });
141+
142+ test ('singleLine' , () {
143+ expect (wrapText ('one two' , width: 10 ), equals ('one two' ));
144+ });
145+
146+ test ('singleLine_exactLength' , () {
147+ expect (wrapText ('one twoooo' , width: 10 ), equals ('one twoooo' ));
148+ });
149+
150+ test ('singleLine_exactLength_minusOne' , () {
151+ expect (wrapText ('one twooo' , width: 10 ), equals ('one twooo' ));
152+ });
153+
154+ test ('singleLine_exactLength_plusOne' , () {
155+ expect (wrapText ('one twooooo' , width: 10 ), equals ('one\n twooooo' ));
156+ });
157+
158+ test ('twoLines_exactLength' , () {
159+ expect (wrapText ('one two three four' , width: 10 ),
160+ equals ('one two\n three four' ));
161+ });
162+
163+ test ('twoLines_exactLength_minusOne' , () {
164+ expect (wrapText ('one two three fou' , width: 10 ),
165+ equals ('one two\n three fou' ));
166+ });
167+
168+ test ('twoLines_exactLength_plusOne' , () {
169+ expect (wrapText ('one two three fourr' , width: 10 ),
170+ equals ('one two\n three\n fourr' ));
171+ });
172+
173+ test ('twoLines_lastLineEndsWithSpace' , () {
174+ expect (wrapText ('one two three ' , width: 10 ), equals ('one two\n three ' ));
175+ });
176+
177+ test ('twoLines_multipleSpacesAtSplit' , () {
178+ expect (
179+ wrapText ('one two. Three' , width: 10 ), equals ('one two. \n Three' ));
180+ });
181+
182+ test ('twoLines_noSpaceLastLine' , () {
183+ expect (wrapText ('one two three' , width: 10 ), equals ('one two\n three' ));
184+ });
185+
186+ test ('twoLines_wordLongerThanLine_firstLine' , () {
187+ expect (wrapText ('http://long-url word' , width: 10 ),
188+ equals ('http://long-url\n word' ));
189+ });
190+
191+ test ('twoLines_wordLongerThanLine_lastLine' , () {
192+ expect (wrapText ('word http://long-url' , width: 10 ),
193+ equals ('word\n http://long-url' ));
194+ });
195+ });
136196}
137197
138198const String _packageData = '''{
0 commit comments