Skip to content

Commit

Permalink
Fixed formatting (#3559)
Browse files Browse the repository at this point in the history
  • Loading branch information
cvpoienaru authored Apr 20, 2022
1 parent 120e100 commit 62ce5a9
Show file tree
Hide file tree
Showing 4 changed files with 1,554 additions and 6 deletions.
34 changes: 34 additions & 0 deletions THIRD-PARTY-NOTICES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
VSTest uses third-party libraries or other resources that may be
distributed under licenses different than the VSTest software.

In the event that we accidentally failed to list a required notice, please
bring it to our attention by posting an issue.

The attached notices are provided for information only.

License notice for SimpleJSON
-------------------------------------
https://github.com/Bunny83/SimpleJSON

The MIT License (MIT)

Copyright (c) 2012-2017 Markus Göbel (Bunny83)

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;

using Microsoft.VisualStudio.TestPlatform.Common.DataCollector;
using Microsoft.VisualStudio.TestPlatform.Common.Telemetry;
using Microsoft.VisualStudio.TestPlatform.ObjectModel;
using Microsoft.VisualStudio.TestPlatform.PlatformAbstractions;

using SimpleJSON;

#nullable disable

namespace Microsoft.VisualStudio.TestPlatform.Common.ExtensionFramework.Utilities;
Expand Down Expand Up @@ -123,7 +124,8 @@ internal static Dictionary<string, HashSet<string>> CreateMergedDictionary(
}

// Copy all the keys in the first dictionary into the resulting dictionary.
var result = new Dictionary<string, HashSet<string>>(first);
var result = first.Where(kvp => (kvp.Value != null && kvp.Value.Count > 0))
.ToDictionary(kvp => kvp.Key, kvp => kvp.Value);

foreach (var kvp in second)
{
Expand Down Expand Up @@ -501,17 +503,22 @@ private void AddCachedExtensionToDictionary<T>(

private static string SerializeExtensionDictionary(IDictionary<string, HashSet<string>> extensions)
{
StringBuilder sb = new();

var jsonObject = new JSONObject();
foreach (var kvp in extensions)
{
if (kvp.Value?.Count > 0)
{
sb.AppendFormat("{0}=[{1}];", kvp.Key, string.Join(",", kvp.Value));
var jsonArray = new JSONArray();
foreach (var extension in kvp.Value)
{
jsonArray.Add(new JSONString(extension));
}

jsonObject.Add(kvp.Key, jsonArray);
}
}

return sb.ToString();
return jsonObject.ToString();
}

private static HashSet<string> MergeSets(HashSet<string> firstSet, HashSet<string> secondSet)
Expand Down
Loading

0 comments on commit 62ce5a9

Please sign in to comment.