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

Unified Diff: pkg/glob/test/match_test.dart

Issue 533323003: Fix glob match and parse tests for Windows and URL styles. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 3 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 | « no previous file | pkg/glob/test/parse_test.dart » ('j') | pkg/glob/test/parse_test.dart » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/glob/test/match_test.dart
diff --git a/pkg/glob/test/match_test.dart b/pkg/glob/test/match_test.dart
index eeb307d8d31d28ec5f63f6ff38780062b7942223..a1369c3520f3c60faf2caf04060a3af081ed6f98 100644
--- a/pkg/glob/test/match_test.dart
+++ b/pkg/glob/test/match_test.dart
@@ -6,8 +6,12 @@ import 'package:glob/glob.dart';
import 'package:path/path.dart' as p;
import 'package:unittest/unittest.dart';
-const ASCII_WITHOUT_SLASH = "\t\n\r !\"#\$%&'()*+`-.0123456789:;<=>?@ABCDEFGHIJ"
- "KLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~";
+const RAW_ASCII_WITHOUT_SLASH = "\t\n\r !\"#\$%&'()*+`-.0123456789:;<=>?@ABCDEF"
+ "GHIJKLMNOPQRSTUVWXYZ[]^_`abcdefghijklmnopqrstuvwxyz{|}~";
+
+// URL-encode the path for a URL context.
+final asciiWithoutSlash = p.style == p.Style.url ?
+ Uri.encodeFull(RAW_ASCII_WITHOUT_SLASH) : RAW_ASCII_WITHOUT_SLASH;
void main() {
test("literals match exactly", () {
@@ -19,7 +23,7 @@ void main() {
group("star", () {
test("matches non-separator characters", () {
var glob = new Glob("*");
- expect(ASCII_WITHOUT_SLASH, contains(glob));
+ expect(asciiWithoutSlash, contains(glob));
});
test("matches the empty string", () {
@@ -36,7 +40,7 @@ void main() {
group("double star", () {
test("matches non-separator characters", () {
var glob = new Glob("**");
- expect(ASCII_WITHOUT_SLASH, contains(glob));
+ expect(asciiWithoutSlash, contains(glob));
});
test("matches the empty string", () {
@@ -65,7 +69,8 @@ void main() {
group("any char", () {
test("matches any non-separator character", () {
var glob = new Glob("foo?");
- for (var char in ASCII_WITHOUT_SLASH.split('')) {
+ for (var char in RAW_ASCII_WITHOUT_SLASH.split('')) {
+ if (p.style == p.Style.url) char = Uri.encodeFull(char);
expect("foo$char", contains(glob));
}
});
« no previous file with comments | « no previous file | pkg/glob/test/parse_test.dart » ('j') | pkg/glob/test/parse_test.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698