Skip to content

Commit f07b4f1

Browse files
committed
Move skipped tests to use traits, fix bug in printer
1 parent 5b4f4a9 commit f07b4f1

19 files changed

+83
-43
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ jobs:
5353
(cd Rewrite && dotnet build Rewrite.sln --no-restore)
5454
- name: test-cs
5555
if: "!startsWith(github.event.head_commit.message, '[lst-change]')"
56-
run: (cd Rewrite && dotnet test Rewrite.sln)
56+
run: (cd Rewrite && dotnet test Rewrite.sln --filter "Category!=KnownBug & Category!=Exploratory")
5757

5858
- name: publish-java-snapshots
5959
if: github.event_name != 'pull_request'

Rewrite/Directory.Build.props

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@
1212
<VersionPrefix>0.8.7</VersionPrefix>
1313
<RewriteRemoteVersion>0.8.4-rc.*</RewriteRemoteVersion>
1414
<RewriteRemoteDir Condition="'$(RewriteRemoteDir)'==''">..\..\..\..\..\moderneinc\rewrite-remote\Rewrite.Remote</RewriteRemoteDir>
15-
<DefineConstants>TRACE;DEBUG;REMOTE_PRINTER</DefineConstants>
15+
<RemotePrinter>True</RemotePrinter>
16+
<DebugVisitor>False</DebugVisitor>
17+
<SanitizeStackTrace>True</SanitizeStackTrace>
1618
</PropertyGroup>
1719

1820
<PropertyGroup Condition="'$(RELEASE_PUBLICATION)'!=''">
@@ -23,4 +25,10 @@
2325
</PropertyGroup>
2426

2527
<Import Project="Directory.Build.props.user" Condition="Exists('Directory.Build.props.user')"/>
28+
29+
<PropertyGroup>
30+
<DefineConstants Condition="'$(RemotePrinter)'">$(DefineConstants);REMOTE_PRINTER</DefineConstants>
31+
<DefineConstants Condition="'$(DebugVisitor)'">$(DefineConstants);DEBUG_VISITOR</DefineConstants>
32+
<DefineConstants Condition="'$(SanitizeStackTrace)'">$(DefineConstants);SANITIZE_STACK_TRACE</DefineConstants>
33+
</PropertyGroup>
2634
</Project>

Rewrite/Directory.Build.targets

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<None Include="$(SolutionDir)resources\$(PackageIcon)" Pack="true" PackagePath="" />
44
</ItemGroup>
55
<ItemGroup>
6-
<PackageReference Include="JetBrains.Annotations" Version="2023.3.0" PrivateAssets="all"/>
6+
<PackageReference Include="JetBrains.Annotations" Version="2024.2.0" PrivateAssets="all"/>
77
</ItemGroup>
88
<ItemGroup>
99
<Using Include="JetBrains.Annotations" />
@@ -14,4 +14,4 @@
1414
DestinationFiles="$(TargetDir)$(PackageIcon)"
1515
SkipUnchangedFiles="true"/>
1616
</Target>
17-
</Project>
17+
</Project>

Rewrite/Rewrite.Sources.sln

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "_solution", "_solution", "{
3030
Directory.Build.props = Directory.Build.props
3131
Directory.Build.targets = Directory.Build.targets
3232
README.md = README.md
33+
Directory.Build.props.user = Directory.Build.props.user
3334
EndProjectSection
3435
EndProject
3536
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Rewrite.CSharp.Test", "..\..\..\moderneinc\rewrite-remote\Rewrite.Remote\src\Rewrite.CSharp.Test\Rewrite.CSharp.Test.csproj", "{E3A7B93C-310E-4109-8F80-C469215FB93B}"

Rewrite/src/Rewrite.Core/Internal/ExceptionUtils.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ public static class ExceptionUtils
66
{
77
public static string SanitizeStackTrace(this Exception exception, Type until)
88
{
9+
#if SANITIZE_STACK_TRACE
910
var sanitized = "";
1011
sanitized = string.Join("\n", sanitized, exception.GetType().Name + ": " + exception.Message);
1112

@@ -26,5 +27,8 @@ public static string SanitizeStackTrace(this Exception exception, Type until)
2627
}
2728

2829
return sanitized;
30+
#else
31+
return exception.ToString();
32+
#endif
2933
}
3034
}

Rewrite/src/Rewrite.Java/JavaPrinter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ namespace Rewrite.RewriteJava;
88
public class JavaPrinter<P> : JavaVisitor<PrintOutputCapture<P>>
99
{
1010
private static readonly Func<string, string> JAVA_MARKER_WRAPPER =
11-
o => $"/*~~{o}{(string.IsNullOrEmpty(o) ? "" : "~~")}*/";
11+
o => $"/*~~{o}{(string.IsNullOrEmpty(o) ? "" : "~~")}>*/";
1212

1313
public JavaPrinter()
1414
{

Rewrite/tests/Rewrite.CSharp.Tests/CSharpTypeAttributionTests.cs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,23 +9,24 @@
99

1010
namespace Rewrite.CSharp.Tests;
1111

12-
using static Assertions;
12+
using static Rewrite.RewriteCSharp.Test.Api.Assertions;
1313

1414
public class CSharpTypeAttributionTests : RewriteTest
1515
{
16-
[Fact(Skip = "For now we dont support Methods")]
16+
[Fact]
17+
[KnownBug]
1718
void ClosureImplicitParameterAttributed()
1819
{
1920
RewriteRun(
2021
CSharp(
2122
"""
22-
public class Program
23+
public class Program
2324
{
2425
public T? register<T>(String name, Type type, Action<T> configurationAction)
2526
{
2627
return default;
2728
}
28-
29+
2930
public void Main()
3031
{
3132
register("test", typeof(Program), (string t) => { });
@@ -70,4 +71,4 @@ class TestJavaVisitor(bool attributed) : JavaVisitor<int>
7071
return variable;
7172
}
7273
}
73-
}
74+
}

Rewrite/tests/Rewrite.CSharp.Tests/FindClassDeclarationTests.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,8 @@ class Foo()
8989
);
9090
}
9191

92-
[Fact(Skip = "For now we dont extract types")]
92+
[Fact]
93+
[KnownBug]
9394
public void ClassWithoutBody2()
9495
{
9596
RewriteRun(

Rewrite/tests/Rewrite.CSharp.Tests/PlayTests.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,10 @@ namespace Rewrite.CSharp.Tests.Tree;
99
using static Assertions;
1010

1111
[Collection(Collections.PrinterAccess)]
12+
[Exploratory]
1213
public class PlayTests(ITestOutputHelper _output) : RewriteTest
1314
{
14-
[Fact(Skip = "Ignored")]
15+
[Fact]
1516
public void MyTest()
1617
{
1718
var root = new CSharpParser.Builder().Build().Parse(
@@ -27,7 +28,7 @@ void Bar()
2728
_output.WriteLine(newRoot.ToString());
2829
}
2930

30-
[Fact(Skip = "Ignored")]
31+
[Fact]
3132
public void ParseTests()
3233
{
3334
var root = new CSharpParser.Builder().Build().Parse(

Rewrite/tests/Rewrite.CSharp.Tests/Rewrite.CSharp.Tests.csproj

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,32 @@
1212
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
1313
</PackageReference>
1414
<PackageReference Include="FluentAssertions" Version="7.0.0-alpha.4" />
15-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.0-release-24352-06" />
15+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
1616
<PackageReference Include="Nuke.Common" Version="8.1.0" />
17-
<PackageReference Include="xunit" Version="2.8.1" />
18-
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.1"/>
17+
<PackageReference Include="xunit" Version="2.9.2" />
18+
<PackageReference Include="Xunit.OpenCategories" Version="1.1.0.4" />
19+
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2">
20+
<PrivateAssets>all</PrivateAssets>
21+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
22+
</PackageReference>
1923
</ItemGroup>
2024

2125
<ItemGroup>
26+
<Using Include="Xunit.Assert" Alias="Assert"/>
27+
<Using Include="Nuke.Common"/>
28+
<Using Include="Nuke.Common"/>
29+
<Using Include="Nuke.Common.IO"/>
30+
<Using Include="FluentAssertions"/>
31+
<Using Include="Rewrite.Core"/>
32+
<Using Include="Rewrite.Test"/>
33+
<Using Include="Rewrite.MSBuild"/>
34+
<Using Include="Rewrite.RewriteCSharp"/>
35+
<Using Include="Rewrite.RewriteJava.Tree"/>
36+
<Using Include="Rewrite.RewriteCSharp.Tree"/>
37+
<Using Include="Rewrite.RewriteCSharp.Test.Api"/>
2238
<Using Include="Xunit"/>
39+
<Using Include="Xunit.Abstractions"/>
40+
<Using Include="Xunit.OpenCategories"/>
2341
</ItemGroup>
2442

2543
<ItemGroup>

0 commit comments

Comments
 (0)