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

Unified Diff: recipe_modules/file/examples/glob.py

Issue 2973133002: [file] fix glob_paths when NO paths match, add tests. (Closed)
Patch Set: Created 3 years, 5 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 | « recipe_engine/unittests/run_test.py ('k') | recipe_modules/file/examples/glob.expected/basic.json » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: recipe_modules/file/examples/glob.py
diff --git a/recipe_modules/file/examples/glob.py b/recipe_modules/file/examples/glob.py
new file mode 100644
index 0000000000000000000000000000000000000000..fad92673d166e1f8501d46270b0a7b36142eb12a
--- /dev/null
+++ b/recipe_modules/file/examples/glob.py
@@ -0,0 +1,29 @@
+# Copyright 2017 The LUCI Authors. All rights reserved.
+# Use of this source code is governed under the Apache License, Version 2.0
+# that can be found in the LICENSE file.
+
+DEPS = [
+ "file",
+ "path",
+ "json",
+]
+
+def RunSteps(api):
+ sd = api.path['start_dir']
+
+ for fname in ['thing.pat', 'other.pat', 'something', 'file']:
+ api.file.write_text("write %s" % fname, sd.join(fname), 'data')
+
+ hits = api.file.glob_paths("pat", sd, '*.pat', ['thing.pat', 'other.pat'])
+ assert hits == [sd.join('other.pat'), sd.join('thing.pat')]
+
+ hits = api.file.glob_paths("noop", sd, '*.nop', [])
+ assert hits == []
+
+ hits = api.file.glob_paths("thing", sd, '*thing*', ['thing.pat', 'something'])
+ assert hits == [sd.join('something'), sd.join('thing.pat')]
+
+
+def GenTests(api):
+ yield api.test('basic')
+
« no previous file with comments | « recipe_engine/unittests/run_test.py ('k') | recipe_modules/file/examples/glob.expected/basic.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698