mirror of
https://github.com/Stone-Red-Code/YesNt-Interpreter.git
synced 2026-09-04 00:56:31 +02:00
@@ -0,0 +1,36 @@
|
||||
name: Deploy Chocolatey Package
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ "main" ]
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
runs-on: windows-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Setup .NET
|
||||
uses: actions/setup-dotnet@v4
|
||||
with:
|
||||
dotnet-version: '10.0.x' # Uses latest available 10.0 SDK
|
||||
|
||||
- name: Build and Pack
|
||||
shell: pwsh
|
||||
run: ./choco/build.ps1
|
||||
env:
|
||||
CI: true
|
||||
|
||||
- name: Push to Chocolatey
|
||||
shell: pwsh
|
||||
run: |
|
||||
$package = Get-ChildItem *.nupkg | Select-Object -First 1
|
||||
if ($package) {
|
||||
choco push $($package.Name) --source "https://push.chocolatey.org/" --api-key ${{ secrets.CHOCO_API_KEY }}
|
||||
} else {
|
||||
Write-Error "No .nupkg file found to push."
|
||||
exit 1
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
# This workflow will build a .NET project
|
||||
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net
|
||||
|
||||
name: .NET
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ "main" ]
|
||||
pull_request:
|
||||
branches: [ "main" ]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Setup .NET
|
||||
uses: actions/setup-dotnet@v4
|
||||
with:
|
||||
dotnet-version: 8.0.x
|
||||
- name: Restore dependencies
|
||||
run: dotnet restore ./src
|
||||
- name: Build
|
||||
run: dotnet build ./src --no-restore
|
||||
- name: Test
|
||||
run: dotnet test ./src --no-build --verbosity normal
|
||||
@@ -39,14 +39,16 @@ public class ConsoleStatementsTests
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void ClearThrowsInNonInteractiveConsoleTest()
|
||||
public void ClearDoesNotCrashInNonInteractiveConsoleTest()
|
||||
{
|
||||
List<string> lines =
|
||||
[
|
||||
"clear"
|
||||
"clear",
|
||||
"var dummy = 0",
|
||||
"${dummy}"
|
||||
];
|
||||
|
||||
_ = Assert.Throws<IOException>(() => YesNtAssert.GetLastLine(lines));
|
||||
YesNtAssert.IsLastLineEqual(lines, "0");
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
|
||||
@@ -12,7 +12,7 @@ public class SystemStatementsTests
|
||||
{
|
||||
List<string> lines =
|
||||
[
|
||||
"exec cmd with /c,echo yesnt",
|
||||
"exec whoami",
|
||||
"var exitCode = %out",
|
||||
"${exitCode}"
|
||||
];
|
||||
@@ -20,14 +20,26 @@ public class SystemStatementsTests
|
||||
YesNtAssert.IsLastLineEqual(lines, "0");
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void ExecWithArgsRunsProcessTestWithArgument()
|
||||
{
|
||||
List<string> lines =
|
||||
[
|
||||
"exec whoami with /?",
|
||||
"var exitCode = %out",
|
||||
"var dummy = 0",
|
||||
"${dummy}"
|
||||
];
|
||||
|
||||
YesNtAssert.IsLastLineEqual(lines, "0");
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void ExecWithInStackArgsRunsProcessTest()
|
||||
{
|
||||
List<string> lines =
|
||||
[
|
||||
"push_in /c",
|
||||
"push_in echo yesnt",
|
||||
"exec cmd",
|
||||
"exec whoami",
|
||||
"var exitCode = %out",
|
||||
"${exitCode}"
|
||||
];
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.IO;
|
||||
|
||||
using YesNt.Interpreter.Attributes;
|
||||
using YesNt.Interpreter.Enums;
|
||||
@@ -60,7 +61,14 @@ internal class ConsoleStatements : StatementRuntimeInformation
|
||||
[Statement("clear", SearchMode.Exact, SpaceAround.None, ConsoleColor.Magenta)]
|
||||
[SuppressMessage("Performance", "CA1822:Mark members as static", Justification = "Won't work if static")]
|
||||
public void Clear(string _)
|
||||
{
|
||||
try
|
||||
{
|
||||
Console.Clear();
|
||||
}
|
||||
catch (IOException)
|
||||
{
|
||||
// Silently fail if the console is not interactive
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user