Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main'
Browse files Browse the repository at this point in the history
# Conflicts:
#	CONTRIBUTING.md
  • Loading branch information
juraj-hrivnak committed Feb 2, 2025
2 parents 6a2cb40 + 19e5d95 commit bd6d209
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,15 @@ To run tests, run the `jvmTest` Gradle task (`gradlew jvmTest`).
Pakku uses Clikt to handle the CLI. It is advised to [check out its docs](https://ajalt.github.io/clikt/).

Command classes should be called the same as the command itself.
If the command is a subcommand, name it using in this pattern: `<parent-command><subcommand>`; example: `CfgPrj`.
If the command is a subcommand, name it using this pattern: `<parent-command><subcommand>`; example: `CfgPrj`.

Command parameters should be _suffixed_ with a special abbreviation of the parameter type. (`<parameter-name><abbrev>`)
Use: `Opt` for options, `Arg` for arguments, and `Flag` for flags (Boolean options).
If there can be multiple parameters use the plural, e.g. `Opts`, `Args`.

Defining of parameters using a chain of function calls is preferred.

```kt
// Parameters should be always private.
// Defining parameters using a chain of function calls is preferred.

private val exampleOpt by option("--example") // Consult if a short version `-e` of the option is a good idea
.help("...") // Consider discussing the help message
Expand All @@ -43,18 +42,18 @@ Documentation for commands can be generated automatically by running: `pakku --g

## Testing

When creating test please extend the `PakkuTest` class.
When creating a test please extend the `PakkuTest` class.
It will ensure every test is run separately in the `build/test/` directory,
and also automatically handle the working path of Pakku and teardown of any created files while running the tests.

For assertions, we use the [Strikt](https://strikt.io/) library, because it is easy to use, read and debug.
For testing, we use the [Strikt](https://strikt.io/) assertion library because it is easy to use, read and debug.

Example of a test:

```kt
class ExampleTest : PakkuTest()
{
private val testFileName = "test_file.txt" // Define test data on the top of the class
private val testFileName = "test_file.txt" // Define test data at the top of the class

override suspend fun `set-up`() // Override this function to implement set up
{
Expand All @@ -74,4 +73,4 @@ class ExampleTest : PakkuTest()
expectThat(file).get { exists() }.isTrue() // Test whether the file exists.
}
}
```
```

0 comments on commit bd6d209

Please sign in to comment.