From 0b17878b1b00e19b82bb48a01e8ea544d1997c4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zolt=C3=A1n=20Leh=C3=B3czky?= Date: Sun, 29 Dec 2024 03:59:05 +0100 Subject: [PATCH] Using simpler NPM dependencies to test ConstantFromJsonAttribute --- .../Models/ConstantFromJsonSample.cs | 15 ++++++++++----- .../SourceGenerators/ConstantFromJsonTest.cs | 8 ++++---- Lombiq.HelpfulLibraries.Tests/package.json | 19 ++----------------- 3 files changed, 16 insertions(+), 26 deletions(-) diff --git a/Lombiq.HelpfulLibraries.Tests/Models/ConstantFromJsonSample.cs b/Lombiq.HelpfulLibraries.Tests/Models/ConstantFromJsonSample.cs index 4dd4f401..f84588a9 100644 --- a/Lombiq.HelpfulLibraries.Tests/Models/ConstantFromJsonSample.cs +++ b/Lombiq.HelpfulLibraries.Tests/Models/ConstantFromJsonSample.cs @@ -1,19 +1,24 @@ -using Lombiq.HelpfulLibraries.Attributes; +using Lombiq.HelpfulLibraries.Attributes; namespace Lombiq.HelpfulLibraries.Tests.Models; /// /// Shows how to use the . /// -[ConstantFromJson(constantName: "GulpUglifyVersion", fileName: "package.json", propertyName: "gulp-uglify")] -[ConstantFromJson(constantName: "GulpVersion", fileName: "package.json", propertyName: "gulp")] +/// +/// +/// Using two really simple packages as a test. +/// +/// +[ConstantFromJson(constantName: "IsEvenVersion", fileName: "package.json", propertyName: "is-even")] +[ConstantFromJson(constantName: "IsOddVersion", fileName: "package.json", propertyName: "is-odd")] public partial class ConstantFromJsonSample { public string ReturnVersions() { var stringBuilder = new System.Text.StringBuilder(); - stringBuilder.AppendLine($"Gulp version: {GulpVersion}"); - stringBuilder.AppendLine($"Gulp-uglify version: {GulpUglifyVersion}"); + stringBuilder.AppendLine($"is-even version: {IsEvenVersion}"); + stringBuilder.AppendLine($"is-odd version: {IsOddVersion}"); return stringBuilder.ToString(); } } diff --git a/Lombiq.HelpfulLibraries.Tests/UnitTests/SourceGenerators/ConstantFromJsonTest.cs b/Lombiq.HelpfulLibraries.Tests/UnitTests/SourceGenerators/ConstantFromJsonTest.cs index 9944648f..7f56a1cf 100644 --- a/Lombiq.HelpfulLibraries.Tests/UnitTests/SourceGenerators/ConstantFromJsonTest.cs +++ b/Lombiq.HelpfulLibraries.Tests/UnitTests/SourceGenerators/ConstantFromJsonTest.cs @@ -1,4 +1,4 @@ -using Lombiq.HelpfulLibraries.Tests.Models; +using Lombiq.HelpfulLibraries.Tests.Models; using Shouldly; using System; using Xunit; @@ -10,11 +10,11 @@ public class ConstantFromJsonTest [Fact] public void TestGeneratedConstants() { - ConstantFromJsonSample.GulpVersion.ShouldBe("3.9.0"); - ConstantFromJsonSample.GulpUglifyVersion.ShouldBe("1.4.1"); + ConstantFromJsonSample.IsEvenVersion.ShouldBe("1.0.0"); + ConstantFromJsonSample.IsOddVersion.ShouldBe("3.0.1"); new ConstantFromJsonSample() .ReturnVersions() .Split(["\n", "\r"], StringSplitOptions.RemoveEmptyEntries) - .ShouldBe(["Gulp version: 3.9.0", "Gulp-uglify version: 1.4.1"]); + .ShouldBe(["is-even version: 1.0.0", "is-odd version: 3.0.1"]); } } diff --git a/Lombiq.HelpfulLibraries.Tests/package.json b/Lombiq.HelpfulLibraries.Tests/package.json index 2662e523..a5dd5817 100644 --- a/Lombiq.HelpfulLibraries.Tests/package.json +++ b/Lombiq.HelpfulLibraries.Tests/package.json @@ -1,23 +1,8 @@ { "private": true, "devDependencies": { - "fs": "0.0.2", - "glob": "5.0.15", - "path-posix": "1.0.0", - "merge-stream": "1.0.0", - "gulp-if": "2.0.0", - "gulp": "3.9.0", - "gulp-newer": "0.5.1", - "gulp-plumber": "1.0.1", - "gulp-sourcemaps": "1.6.0", - "gulp-less": "3.0.3", - "gulp-autoprefixer": "2.2.0", - "gulp-minify-css": "1.2.1", - "gulp-typescript": "2.9.2", - "gulp-uglify": "1.4.1", - "gulp-rename": "1.2.2", - "gulp-concat": "2.6.0", - "gulp-header": "1.7.1" + "is-even": "1.0.0", + "is-odd": "3.0.1" }, "dependencies": { } }