diff options
author | Jeffrey Stedfast <jestedfa@microsoft.com> | 2019-07-26 20:06:54 +0300 |
---|---|---|
committer | Jeffrey Stedfast <jestedfa@microsoft.com> | 2019-07-26 20:06:54 +0300 |
commit | 67f4c0243307ed435c3581e74dd2a7e29f8e288c (patch) | |
tree | 09237c5c5f4238e946b7263fe3e2cf4eaf92eb15 /main/src/addins | |
parent | 701538f3018c08a5ab6406f119a137b0cf83a212 (diff) |
[Debbugger] Added unit tests
Diffstat (limited to 'main/src/addins')
3 files changed, 56 insertions, 2 deletions
diff --git a/main/src/addins/MonoDevelop.Debugger.VSCodeDebugProtocol/MonoDevelop.Debugger.VsCodeDebugProtocol/VsCodeStackFrame.cs b/main/src/addins/MonoDevelop.Debugger.VSCodeDebugProtocol/MonoDevelop.Debugger.VsCodeDebugProtocol/VsCodeStackFrame.cs index ee0c8e77ac..a72aeb7634 100644 --- a/main/src/addins/MonoDevelop.Debugger.VSCodeDebugProtocol/MonoDevelop.Debugger.VsCodeDebugProtocol/VsCodeStackFrame.cs +++ b/main/src/addins/MonoDevelop.Debugger.VSCodeDebugProtocol/MonoDevelop.Debugger.VsCodeDebugProtocol/VsCodeStackFrame.cs @@ -10,7 +10,7 @@ using VsFormat = Microsoft.VisualStudio.Shared.VSCodeDebugProtocol.Messages.Stac namespace MonoDevelop.Debugger.VsCodeDebugProtocol { - class VsCodeStackFrame : Mono.Debugging.Client.StackFrame + public class VsCodeStackFrame : Mono.Debugging.Client.StackFrame { public static VsFormat GetStackFrameFormat (EvaluationOptions evalOptions) { @@ -72,7 +72,7 @@ namespace MonoDevelop.Debugger.VsCodeDebugProtocol throw new ArgumentException (); } - static byte[] HexToByteArray (string hex) + public static byte[] HexToByteArray (string hex) { if (hex.Length % 2 == 1) return null; diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests/MonoDevelop.Debugger.Tests.csproj b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests/MonoDevelop.Debugger.Tests.csproj index 66a368f365..75a26167f2 100644 --- a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests/MonoDevelop.Debugger.Tests.csproj +++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests/MonoDevelop.Debugger.Tests.csproj @@ -21,6 +21,7 @@ <Compile Include="..\..\..\..\external\debugger-libs\UnitTests\Mono.Debugging.Tests\Shared\Win32\*.cs" /> <Compile Include="DebugTests.MonoDevelop.cs" /> <Compile Include="TextFile.cs" /> + <Compile Include="VsCodeStackFrameTests.cs" /> </ItemGroup> <ItemGroup> <ProjectReference Include="..\MonoDevelop.Debugger.csproj"> @@ -63,6 +64,10 @@ <Name>Mono.Debugging.Soft</Name> <Private>False</Private> </ProjectReference> + <ProjectReference Include="..\..\MonoDevelop.Debugger.VSCodeDebugProtocol\MonoDevelop.Debugger.VsCodeDebugProtocol\MonoDevelop.Debugger.VsCodeDebugProtocol.csproj"> + <Project>{10F5BBD5-8A1D-4563-BCE4-DE681DFD82FD}</Project> + <Name>MonoDevelop.Debugger.VsCodeDebugProtocol</Name> + </ProjectReference> </ItemGroup> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> <Target Name="AfterBuild"> diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests/VsCodeStackFrameTests.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests/VsCodeStackFrameTests.cs new file mode 100644 index 0000000000..3576b8d19f --- /dev/null +++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests/VsCodeStackFrameTests.cs @@ -0,0 +1,49 @@ +// +// VsCodeStackFrameTests.cs +// +// Author: +// Jeffrey Stedfast <jestedfa@microsoft.com> +// +// Copyright (c) 2019 Microsoft Corp. +// +// 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. + +using NUnit.Framework; + +using MonoDevelop.Debugger.VsCodeDebugProtocol; + +namespace MonoDevelop.Debugger.Tests +{ + [TestFixture] + public class VsCodeStackFrameTests + { + [Test] + public void TestHexDecode () + { + var result = VsCodeStackFrame.HexToByteArray ("fFaAbB0012a1"); + + Assert.AreEqual ((byte) 0xff, result[0], "result[0]"); + Assert.AreEqual ((byte) 0xaa, result[1], "result[1]"); + Assert.AreEqual ((byte) 0xbb, result[2], "result[2]"); + Assert.AreEqual ((byte) 0x00, result[3], "result[3]"); + Assert.AreEqual ((byte) 0x12, result[4], "result[4]"); + Assert.AreEqual ((byte) 0xa1, result[5], "result[5]"); + } + } +} |