Skip to content

Commit

Permalink
Merge pull request #21 from AliceNovel/test
Browse files Browse the repository at this point in the history
Added: Test code
  • Loading branch information
Lemon73-Computing authored Apr 27, 2024
2 parents 1dd9d63 + eaf2f96 commit 803ec72
Show file tree
Hide file tree
Showing 5 changed files with 84 additions and 3 deletions.
5 changes: 2 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build & Test
name: Build

on:
push:
Expand All @@ -23,7 +23,6 @@ jobs:
dotnet-version: 8.0.x

- uses: actions/checkout@v4
- name: Build & Test
- name: Build
run: |
dotnet build AnovSyntax/AnovSyntax.csproj -c Release
dotnet test AnovSyntax/AnovSyntax.csproj
28 changes: 28 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Test

on:
push:
branches: [ main ]
paths-ignore:
- "**.md"
pull_request:
branches: [ main ]
paths-ignore:
- "**.md"

jobs:
build:
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x

- uses: actions/checkout@v4
- name: Test
run: |
dotnet test Test/Test.csproj
6 changes: 6 additions & 0 deletions AliceConsole.sln
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AnovSyntax", "AnovSyntax\An
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AliceConsole", "AliceConsole\AliceConsole.csproj", "{BCFC05BD-904F-4C84-B160-D88DF9E62401}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Test", "Test\Test.csproj", "{3B95FAFE-9285-4C83-BCD9-CB183C670EC9}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -24,5 +26,9 @@ Global
{BCFC05BD-904F-4C84-B160-D88DF9E62401}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BCFC05BD-904F-4C84-B160-D88DF9E62401}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BCFC05BD-904F-4C84-B160-D88DF9E62401}.Release|Any CPU.Build.0 = Release|Any CPU
{3B95FAFE-9285-4C83-BCD9-CB183C670EC9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3B95FAFE-9285-4C83-BCD9-CB183C670EC9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3B95FAFE-9285-4C83-BCD9-CB183C670EC9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3B95FAFE-9285-4C83-BCD9-CB183C670EC9}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal
27 changes: 27 additions & 0 deletions Test/Test.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>

<IsPackable>false</IsPackable>
<IsTestProject>true</IsTestProject>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="coverlet.collector" Version="6.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="MSTest.TestAdapter" Version="3.1.1" />
<PackageReference Include="MSTest.TestFramework" Version="3.1.1" />
</ItemGroup>

<ItemGroup>
<Using Include="Microsoft.VisualStudio.TestTools.UnitTesting" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\AnovSyntax\AnovSyntax.csproj" />
</ItemGroup>

</Project>
21 changes: 21 additions & 0 deletions Test/UnitTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
using AnovSyntax;

namespace Test;

[TestClass]
public class UnitTest
{
[TestMethod]
public void TestPeople()
{
string input = "- Alice";
Assert.AreEqual("Alice", Anov.Read(input));
}

[TestMethod]
public void TestConversation()
{
string input = "[Hello World!]";
Assert.AreEqual(" \"Hello World!\"", Anov.Read(input));
}
}

0 comments on commit 803ec72

Please sign in to comment.