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

Side by Side Diff: test/match_test.dart

Issue 1491003002: Add a caseSensitive flag to new Glob(). (Closed) Base URL: git@github.com:dart-lang/glob@master
Patch Set: Code review changes Created 5 years 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 unified diff | Download patch
« no previous file with comments | « test/list_test.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 import 'package:glob/glob.dart'; 5 import 'package:glob/glob.dart';
6 import 'package:glob/src/utils.dart'; 6 import 'package:glob/src/utils.dart';
7 import 'package:path/path.dart' as p; 7 import 'package:path/path.dart' as p;
8 import 'package:test/test.dart'; 8 import 'package:test/test.dart';
9 9
10 const RAW_ASCII_WITHOUT_SLASH = "\t\n\r !\"#\$%&'()*+`-.0123456789:;<=>?@ABCDEF" 10 const RAW_ASCII_WITHOUT_SLASH = "\t\n\r !\"#\$%&'()*+`-.0123456789:;<=>?@ABCDEF"
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 isNot(contains(new Glob("**", context: p.url)))); 284 isNot(contains(new Glob("**", context: p.url))));
285 expect(r"http://foo.com/bar", 285 expect(r"http://foo.com/bar",
286 contains(new Glob("http://**", context: p.url))); 286 contains(new Glob("http://**", context: p.url)));
287 expect(r"http://foo.com/bar", 287 expect(r"http://foo.com/bar",
288 contains(new Glob("http://foo.com/**", context: p.url))); 288 contains(new Glob("http://foo.com/**", context: p.url)));
289 289
290 expect("/foo/bar", contains(new Glob("/foo/bar", context: p.url))); 290 expect("/foo/bar", contains(new Glob("/foo/bar", context: p.url)));
291 expect("/foo/bar", isNot(contains(new Glob("**", context: p.url)))); 291 expect("/foo/bar", isNot(contains(new Glob("**", context: p.url))));
292 expect("/foo/bar", contains(new Glob("/**", context: p.url))); 292 expect("/foo/bar", contains(new Glob("/**", context: p.url)));
293 }); 293 });
294
295 group("when case-sensitive", () {
296 test("literals match case-sensitively", () {
297 expect("foo", contains(new Glob("foo", caseSensitive: true)));
298 expect("FOO", isNot(contains(new Glob("foo", caseSensitive: true))));
299 expect("foo", isNot(contains(new Glob("FOO", caseSensitive: true))));
300 });
301
302 test("ranges match case-sensitively", () {
303 expect("foo", contains(new Glob("[fx][a-z]o", caseSensitive: true)));
304 expect("FOO",
305 isNot(contains(new Glob("[fx][a-z]o", caseSensitive: true))));
306 expect("foo",
307 isNot(contains(new Glob("[FX][A-Z]O", caseSensitive: true))));
308 });
309
310 test("sequences preserve case-sensitivity", () {
311 expect("foo/bar", contains(new Glob("foo/bar", caseSensitive: true)));
312 expect("FOO/BAR",
313 isNot(contains(new Glob("foo/bar", caseSensitive: true))));
314 expect("foo/bar",
315 isNot(contains(new Glob("FOO/BAR", caseSensitive: true))));
316 });
317
318 test("options preserve case-sensitivity", () {
319 expect("foo", contains(new Glob("{foo,bar}", caseSensitive: true)));
320 expect("FOO",
321 isNot(contains(new Glob("{foo,bar}", caseSensitive: true))));
322 expect("foo",
323 isNot(contains(new Glob("{FOO,BAR}", caseSensitive: true))));
324 });
325 });
326
327 group("when case-insensitive", () {
328 test("literals match case-insensitively", () {
329 expect("foo", contains(new Glob("foo", caseSensitive: false)));
330 expect("FOO", contains(new Glob("foo", caseSensitive: false)));
331 expect("foo", contains(new Glob("FOO", caseSensitive: false)));
332 });
333
334 test("ranges match case-insensitively", () {
335 expect("foo", contains(new Glob("[fx][a-z]o", caseSensitive: false)));
336 expect("FOO", contains(new Glob("[fx][a-z]o", caseSensitive: false)));
337 expect("foo", contains(new Glob("[FX][A-Z]O", caseSensitive: false)));
338 });
339
340 test("sequences preserve case-insensitivity", () {
341 expect("foo/bar", contains(new Glob("foo/bar", caseSensitive: false)));
342 expect("FOO/BAR", contains(new Glob("foo/bar", caseSensitive: false)));
343 expect("foo/bar", contains(new Glob("FOO/BAR", caseSensitive: false)));
344 });
345
346 test("options preserve case-insensitivity", () {
347 expect("foo", contains(new Glob("{foo,bar}", caseSensitive: false)));
348 expect("FOO", contains(new Glob("{foo,bar}", caseSensitive: false)));
349 expect("foo", contains(new Glob("{FOO,BAR}", caseSensitive: false)));
350 });
351 });
294 } 352 }
OLDNEW
« no previous file with comments | « test/list_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698