test: add more test cases in inputs.test.ts testing

This commit is contained in:
Alfi Maulana 2024-03-25 00:05:20 +07:00
parent 6802dab2a1
commit ce18273a9d
No known key found for this signature in database
GPG Key ID: 2242A64C2A8DF5A4

View File

@ -20,6 +20,65 @@ describe("get action inputs", () => {
{
name: "with nothing specified",
},
{
name: "with source directory specified",
stringInputs: { "source-dir": "project" },
expectedInputs: { sourceDir: "project" },
},
{
name: "with build directory specified",
stringInputs: { "build-dir": "output" },
expectedInputs: { buildDir: "output" },
},
{
name: "with generator specified",
stringInputs: { generator: "Ninja" },
expectedInputs: { generator: "Ninja" },
},
{
name: "with C compiler specified",
stringInputs: { "c-compiler": "clang" },
expectedInputs: { cCompiler: "clang" },
},
{
name: "with C++ compiler specified",
stringInputs: { "cxx-compiler": "clang++" },
expectedInputs: { cxxCompiler: "clang++" },
},
{
name: "with C flags specified",
multilineInputs: { "c-flags": ["-Werror -Wall", "-Wextra"] },
expectedInputs: { cFlags: "-Werror -Wall -Wextra" },
},
{
name: "with C++ flags specified",
multilineInputs: { "cxx-flags": ["-Werror -Wall", "-Wextra -Wpedantic"] },
expectedInputs: { cxxFlags: "-Werror -Wall -Wextra -Wpedantic" },
},
{
name: "with additional options specified",
multilineInputs: {
options: ["BUILD_TESTING=ON BUILD_EXAMPLES=ON", "BUILD_DOCS=ON"],
},
expectedInputs: {
options: ["BUILD_TESTING=ON", "BUILD_EXAMPLES=ON", "BUILD_DOCS=ON"],
},
},
{
name: "with additional arguments specified",
multilineInputs: { args: ["-Wdev -Wdeprecated", "--fresh"] },
expectedInputs: { args: ["-Wdev", "-Wdeprecated", "--fresh"] },
},
{
name: "with run build specified",
booleanInputs: { "run-build": false },
expectedInputs: { runBuild: false },
},
{
name: "with additional build arguments specified",
multilineInputs: { "build-args": ["--target foo", "--parallel 8"] },
expectedInputs: { buildArgs: ["--target", "foo", "--parallel", "8"] },
},
{
name: "with all specified",
booleanInputs: {