Skip to content
This repository has been archived by the owner on Nov 22, 2023. It is now read-only.

Check dotnet format in travis #198

Merged
merged 16 commits into from
Sep 13, 2019
18 changes: 18 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
###############################
# Core EditorConfig Options #
###############################

# dotnet-format requires version 3.1.37601
# dotnet tool update -g dotnet-format
# remember to have: git config --global core.autocrlf false #(which is usually default)

root = true

# Every file

[*]
insert_final_newline = true
trim_trailing_whitespace = true
charset = utf-8
end_of_line = lf
#indent_style = tab # TODO
erikzhang marked this conversation as resolved.
Show resolved Hide resolved
9 changes: 7 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,17 @@ dotnet: 2.2.300
before_install:
- cd tests/neo-vm.Tests
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then ulimit -n 2048; fi

install:
- dotnet tool install -g dotnet-format --version 4.0.40103 --add-source https://dotnet.myget.org/F/format/api/v3/index.json
- export PATH="$PATH:$HOME/.dotnet/tools"
- dotnet-format --version
before_script:
- echo "Checking format..."
- dotnet format --check --dry-run -w . -v diagnostic # check C# formatting for neo.sln
script:
- dotnet restore
- find * -name *.csproj | xargs -I % dotnet add % package coverlet.msbuild
- dotnet test /p:CollectCoverage=true /p:CoverletOutputFormat=opencover

after_success:
# After all tests OK, Send CodeDov report
- echo "Test Success - Branch($TRAVIS_BRANCH) Pull Request($TRAVIS_PULL_REQUEST) Tag($TRAVIS_TAG)"
Expand Down
2 changes: 1 addition & 1 deletion src/neo-vm/OpCode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -644,7 +644,7 @@ public enum OpCode : byte

//Reserved = 0xAC,
//Reserved = 0xAE,

// Array
/// <summary>
/// An array is removed from top of the main stack. Its size is put on top of the main stack.
Expand Down
2 changes: 1 addition & 1 deletion src/neo-vm/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
using System.Runtime.CompilerServices;

[assembly: InternalsVisibleTo("neo-vm.Tests")]
[assembly: InternalsVisibleTo("neo-vm.Tests")]
2 changes: 1 addition & 1 deletion src/neo-vm/RandomAccessStack.cs
Original file line number Diff line number Diff line change
Expand Up @@ -95,4 +95,4 @@ public void Set(int index, T item)
list[(list.Count - index - 1)] = item;
}
}
}
}
2 changes: 1 addition & 1 deletion tests/neo-vm.Tests/Converters/ScriptConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,4 @@ public override void WriteJson(JsonWriter writer, object value, JsonSerializer s
}
}
}
}
}
2 changes: 1 addition & 1 deletion tests/neo-vm.Tests/Extensions/JsonExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,4 @@ public static string ToJson(this object ut)
return JsonConvert.SerializeObject(ut, _settings);
}
}
}
}
2 changes: 1 addition & 1 deletion tests/neo-vm.Tests/Extensions/StringExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,4 @@ public static byte[] FromHexString(this string value)
return result;
}
}
}
}
2 changes: 1 addition & 1 deletion tests/neo-vm.Tests/Helpers/RandomHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,4 @@ public static short RandInt16()
return (short)_rand.Next(short.MaxValue);
}
}
}
}
2 changes: 1 addition & 1 deletion tests/neo-vm.Tests/Types/VMUT.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ public class VMUT
[JsonProperty]
public VMUTEntry[] Tests { get; set; }
}
}
}
2 changes: 1 addition & 1 deletion tests/neo-vm.Tests/Types/VMUTActionType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ public enum VMUTActionType
StepOut,
StepOver,
}
}
}
2 changes: 1 addition & 1 deletion tests/neo-vm.Tests/Types/VMUTEntry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ public class VMUTEntry
[JsonProperty]
public VMUTStep[] Steps { get; set; }
}
}
}
2 changes: 1 addition & 1 deletion tests/neo-vm.Tests/Types/VMUTExecutionContextState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ public class VMUTExecutionContextState
[JsonProperty]
public VMUTStackItem[] EvaluationStack { get; set; }
}
}
}
2 changes: 1 addition & 1 deletion tests/neo-vm.Tests/Types/VMUTExecutionEngineState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ public class VMUTExecutionEngineState
[JsonProperty]
public VMUTExecutionContextState[] InvocationStack { get; set; }
}
}
}
2 changes: 1 addition & 1 deletion tests/neo-vm.Tests/Types/VMUTStackItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ public class VMUTStackItem
[JsonProperty]
public JToken Value { get; set; }
}
}
}
12 changes: 6 additions & 6 deletions tests/neo-vm.Tests/Types/VMUTStackItemType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,27 @@ public enum VMUTStackItemType
/// Boolean (true,false)
/// </summary>
Boolean,

/// <summary>
/// ByteArray
/// </summary>
ByteArray,

/// <summary>
/// ByteArray as UTF8 string
/// </summary>
String,

/// <summary>
/// String
/// </summary>
Interop,

/// <summary>
/// BigInteger
/// </summary>
Integer,

/// <summary>
/// Array
/// </summary>
Expand All @@ -42,4 +42,4 @@ public enum VMUTStackItemType
/// </summary>
Map
}
}
}
2 changes: 1 addition & 1 deletion tests/neo-vm.Tests/Types/VMUTStep.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ public class VMUTStep
[JsonProperty]
public VMUTExecutionEngineState Result { get; set; }
}
}
}
45 changes: 30 additions & 15 deletions tests/neo-vm.Tests/UtDebugger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,16 @@ public void TestStepOver()
using (var engine = new ExecutionEngine())
using (var script = new ScriptBuilder())
{
/* ┌ */ script.EmitJump(OpCode.CALL, 5);
/* │ ┌> */ script.Emit(OpCode.NOT);
/* │ │ */ script.Emit(OpCode.RET);
/* └> │ */ script.Emit(OpCode.PUSH0);
/* └─┘ */ script.Emit(OpCode.RET);
/* ┌ CALL
│ ┌> NOT
│ │ RET
└> │ PUSH0
└─┘ RET */
script.EmitJump(OpCode.CALL, 5);
script.Emit(OpCode.NOT);
script.Emit(OpCode.RET);
script.Emit(OpCode.PUSH0);
script.Emit(OpCode.RET);

engine.LoadScript(script.ToArray());

Expand Down Expand Up @@ -107,11 +112,16 @@ public void TestStepInto()
using (var engine = new ExecutionEngine())
using (var script = new ScriptBuilder())
{
/* ┌ */ script.EmitJump(OpCode.CALL, 5);
/* │ ┌> */ script.Emit(OpCode.NOT);
/* │ │ */ script.Emit(OpCode.RET);
/* └> │ */ script.Emit(OpCode.PUSH0);
/* └─┘ */ script.Emit(OpCode.RET);
/* ┌ CALL
│ ┌> NOT
│ │ RET
└> │ PUSH0
└─┘ RET */
script.EmitJump(OpCode.CALL, 5);
script.Emit(OpCode.NOT);
script.Emit(OpCode.RET);
script.Emit(OpCode.PUSH0);
script.Emit(OpCode.RET);

engine.LoadScript(script.ToArray());

Expand Down Expand Up @@ -158,11 +168,16 @@ public void TestBreakPointStepOver()
using (var engine = new ExecutionEngine())
using (var script = new ScriptBuilder())
{
/* ┌ */ script.EmitJump(OpCode.CALL, 5);
/* │ ┌> */ script.Emit(OpCode.NOT);
/* │ │ */ script.Emit(OpCode.RET);
/* └>X│ */ script.Emit(OpCode.PUSH0);
/* └┘ */ script.Emit(OpCode.RET);
/* ┌ CALL
│ ┌> NOT
│ │ RET
└>X│ PUSH0
└┘ RET */
script.EmitJump(OpCode.CALL, 5);
shargon marked this conversation as resolved.
Show resolved Hide resolved
script.Emit(OpCode.NOT);
script.Emit(OpCode.RET);
script.Emit(OpCode.PUSH0);
script.Emit(OpCode.RET);

engine.LoadScript(script.ToArray());

Expand Down
2 changes: 1 addition & 1 deletion tests/neo-vm.Tests/UtRandomAccessStack.cs
Original file line number Diff line number Diff line change
Expand Up @@ -147,4 +147,4 @@ public void TestSet()
CollectionAssert.AreEqual(new int[] { 1, 2, 3, 4 }, stack.Select(u => u).ToArray());
}
}
}
}
2 changes: 1 addition & 1 deletion tests/neo-vm.Tests/UtScript.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,4 +75,4 @@ public void Parse()
Assert.AreSame(ins, Instruction.RET);
}
}
}
}
2 changes: 1 addition & 1 deletion tests/neo-vm.Tests/UtScriptBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -211,4 +211,4 @@ public void TestEmitPushString()
}
}
}
}
}
2 changes: 1 addition & 1 deletion tests/neo-vm.Tests/UtStackItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -129,4 +129,4 @@ public void CastTest()

}
}
}
}
Loading