public void ParseMultilineWithRestoreKeys()
 {
     (bool isOldFormat, string[] keySegments, IEnumerable <string[]> restoreKeys) = PipelineCacheTaskPluginBase.ParseIntoSegments(
         string.Empty,
         "$(Agent.OS) | Gemfile.lock | **/*.gemspec,!./junk/**",
         "$(Agent.OS) | Gemfile.lock\n$(Agent.OS)");
     Assert.False(isOldFormat);
     Assert.Equal(new [] { "$(Agent.OS)", "Gemfile.lock", "**/*.gemspec,!./junk/**" }, keySegments);
     Assert.Equal(new [] { new [] { "$(Agent.OS)", "Gemfile.lock" }, new[] { "$(Agent.OS)" } }, restoreKeys);
 }
 public void ParseMultilineKeyAsOld()
 {
     (bool isOldFormat, string[] keySegments, IEnumerable <string[]> restoreKeys) = PipelineCacheTaskPluginBase.ParseIntoSegments(
         string.Empty,
         "gems\n$(Agent.OS)\n$(Build.SourcesDirectory)/my.gemspec",
         string.Empty);
     Assert.True(isOldFormat);
     Assert.Equal(new [] { "gems", "$(Agent.OS)", "$(Build.SourcesDirectory)/my.gemspec" }, keySegments);
     Assert.Equal(0, restoreKeys.Count());
 }
 public void ParseSingleLineAsNew()
 {
     (bool isOldFormat, string[] keySegments, IEnumerable <string[]> restoreKeys) = PipelineCacheTaskPluginBase.ParseIntoSegments(
         string.Empty,
         "$(Agent.OS)",
         string.Empty);
     Assert.False(isOldFormat);
     Assert.Equal(new [] { "$(Agent.OS)" }, keySegments);
     Assert.Equal(0, restoreKeys.Count());
 }
Exemple #4
0
 public void ParsePathSegments()
 {
     (bool isOldFormat, string[] keySegments, IEnumerable <string[]> restoreKeys, string[] pathSegments) = PipelineCacheTaskPluginBase.ParseIntoSegments(
         string.Empty,
         string.Empty,
         string.Empty,
         "node_modules | dist | **/globby.*,!**.exclude");
     Assert.False(isOldFormat);
     Assert.Equal(new[] { "node_modules", "dist", "**/globby.*,!**.exclude" }, pathSegments);
 }