Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reformatting test files with basic editor config settings. #620

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,13 @@ class ClassName
{
void MethodName()
{
Func<bool, bool> f1 = delegate(bool a)
{
return !a;
};
Func<bool, bool> f1 = delegate(bool a) { return !a; };

Func<bool, bool> f2 = static delegate(bool a)
{
return !a;
};
Func<bool, bool> f2 = static delegate(bool a) { return !a; };

Func<bool, bool> f3 = async delegate(bool a)
{
return await !a;
};
Func<bool, bool> f3 = async delegate(bool a) { return await !a; };

Func<bool, bool> f4 = async static delegate(bool a)
{
return await !a;
};
Func<bool, bool> f4 = async static delegate(bool a) { return await !a; };

Func<bool, bool> f5 = delegate(
string longName,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@ class ClassName

var chainFormatting =
anotherVariable1 =
anotherVariable2 =
"someValue____________________________________________";
anotherVariable2 =
"someValue____________________________________________";

chainFormatting =
anotherVariable1 =
anotherVariable2 =
"someValue____________________________________________";
anotherVariable2 =
"someValue____________________________________________";

var nonChainFormatting = anotherVariable1 = CallMethod(
parameter________________________________,
Expand All @@ -54,19 +54,19 @@ class ClassName

var chainFormatting =
anotherVariable1 =
anotherVariable2 =
CallMethod(
parameter________________________________,
parameter________________________________
);
anotherVariable2 =
CallMethod(
parameter________________________________,
parameter________________________________
);

chainFormatting =
anotherVariable1 =
anotherVariable2 =
CallMethod(
parameter________________________________,
parameter________________________________
);
anotherVariable2 =
CallMethod(
parameter________________________________,
parameter________________________________
);
}

public SomeExpressionBodyMethod() =>
Expand All @@ -78,7 +78,7 @@ class ClassName
public SomeExpressionBodyMethod() =>
chainFormatting =
anotherVariable1 =
anotherVariable2 =
anotherVariable2 =
(
someCondition________________________________
|| someOtherCondition___________________________
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
namespace Namespace
{
[Obsolete]
class ClassOne { }
class ClassOne
{
}

[Obsolete]

[NoNewLine]

// do stuff
class ClassTwo { }
class ClassTwo
{
}

class ClassThree { }
class ClassThree
{
}
}
64 changes: 40 additions & 24 deletions Src/CSharpier.Tests/FormattingTests/TestFiles/AttributeLists.cst
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,15 @@
[Obsolete]
class ClassName
{
[Obsolete]
private string Field;
[Obsolete] private string Field;

[Obsolete]
public string Property
{
[Obsolete]
get;
[Obsolete]
set;
}
public string Property { [Obsolete] get; [Obsolete] set; }

[Obsolete, NonSerialized]
void MethodName([In] string value) { }
void MethodName([In] string value)
{
}

[
Obsolete,
Expand All @@ -32,27 +27,37 @@ class ClassName
static extern bool NameEquals(string name, SecurityAttribute sa);

[Obsolete("Error", error: true)]
void NameColon() { }
void NameColon()
{
}

[return: Obsolete]
[method: Obsolete]
void Targets() { }
void Targets()
{
}

// leading
[Obsolete] // trailing
class ClassOne { }
class ClassOne
{
}

// leading with new line
[Obsolete] // more trailing
// leading before class
class ClassTwo { }
class ClassTwo
{
}

[LongAttributeWithParametersBreaking(
"someValue_____________",
"someValue_____________",
"someValue_____________"
)]
void LongAttribute() { }
void LongAttribute()
{
}

public void MethodName([FromBody] SomeParameter parameter)
{
Expand All @@ -63,34 +68,43 @@ class ClassName
int someParameter,
[ShortAttributeName] AnotherObject anotherObject,
[VeryLongAttributeName(SomeFlag.SomeValue, SomeOtherFlag.SomeOtherLongValue)]
string tabbedBreakParameter,
string tabbedBreakParameter,
bool anotherParameter
)
{
return;
}

public void MethodWithAttributesOnTypeParameters<[SomeShort] T, K>() { }
public void MethodWithAttributesOnTypeParameters<[SomeShort] T, K>()
{
}

public void MethodWithAttributesOnTypeParameters<
[SomeLongAttribute__________________________] T,
[SomeLongAttribute__________________________]
T,
K
>() { }
>()
{
}

public void MethodWithAttributesOnTypeParameters<
[SomeLongAttribute__________________________]
TSomeMuchLongerName___________________________________,
TSomeMuchLongerName___________________________________,
K
>() { }
>()
{
}

public void MethodWithAttributesOnTypeParameters<
[SomeAttributeWithParameters(
longParameter_____________________________,
longParameter_____________________________
)]
TSomeMuchLongerName___________________________________,
TSomeMuchLongerName___________________________________,
K
>() { }
>()
{
}
}

[
Expand All @@ -101,4 +115,6 @@ class ClassName
),
AnotherAttribute
]
public class ClassName { }
public class ClassName
{
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
// <autogenerated />

using System;
using System.Reflection;

[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETCoreApp,Version=v5.0", FrameworkDisplayName = "")]
Loading