Skip to content

Commit

Permalink
Use p.prettyUri() for Node API tests
Browse files Browse the repository at this point in the history
  • Loading branch information
nex3 committed Sep 4, 2020
1 parent e060e99 commit 3fbd83e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
9 changes: 5 additions & 4 deletions test/node_api_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import 'hybrid.dart';
import 'node_api/api.dart';
import 'node_api/intercept_stdout.dart';
import 'node_api/utils.dart';
import 'utils.dart';

String sassPath;

Expand Down Expand Up @@ -294,7 +295,7 @@ a {
"1 │ x {y: }\n"
" │ ^\n"
" ╵\n"
" $sassPath 1:7 root stylesheet"));
" ${prettyPath(sassPath)} 1:7 root stylesheet"));
});
});

Expand Down Expand Up @@ -369,7 +370,7 @@ a {
"1 │ a {b: }\n"
" │ ^\n"
" ╵\n"
" $sassPath 1:7 root stylesheet"));
" ${prettyPath(sassPath)} 1:7 root stylesheet"));
});

test("sets the line, column, and filename", () {
Expand Down Expand Up @@ -420,7 +421,7 @@ a {
'1 │ a {b: 1 % a}\n'
' │ ^^^^^\n'
' ╵\n'
' $sassPath 1:7 root stylesheet'));
' ${prettyPath(sassPath)} 1:7 root stylesheet'));
});

test("sets the line, column, and filename", () {
Expand Down Expand Up @@ -494,7 +495,7 @@ a {
"1 │ a {b: }\n"
" │ ^\n"
" ╵\n"
" $sassPath 1:7 root stylesheet"));
" ${prettyPath(sassPath)} 1:7 root stylesheet"));
});
});
}
4 changes: 4 additions & 0 deletions test/utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import 'dart:async';
import 'dart:convert';

import 'package:path/path.dart' as p;
import 'package:test/test.dart';

import 'package:sass/src/io.dart';
Expand All @@ -31,3 +32,6 @@ Map<String, Object> embeddedSourceMap(String css) {
expect(data.mimeType, equals("application/json"));
return jsonDecode(data.contentAsString()) as Map<String, Object>;
}

// Like `p.prettyUri()`, but for a non-URL path.
String prettyPath(String path) => p.prettyUri(p.toUri(path));

0 comments on commit 3fbd83e

Please sign in to comment.