[InlineData("a{a,/}b")] // literal contains '/' public void ParseInvalid(string pattern) { Assert.False(Glob.TryParse(pattern, GlobOptions.None, out var result)); Assert.Null(result); Assert.Throws <ArgumentException>(() => Glob.Parse(pattern, GlobOptions.None)); }
private static async Task <int> ReplaceValue(string?filePath, string?globPattern, string xpath, string newValue) { if (filePath != null) { await UpdateFileAsync(filePath, xpath, newValue); } if (globPattern != null) { if (!Glob.TryParse(globPattern, GlobOptions.None, out var glob)) { Console.Error.WriteLine($"Glob pattern '{globPattern}' is invalid"); return(-1); } foreach (var file in glob.EnumerateFiles(Environment.CurrentDirectory)) { await UpdateFileAsync(file, xpath, newValue); } } return(0);