-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor Inquirer and add testing module for it #3483
- Loading branch information
Showing
5 changed files
with
196 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
...Inquirer/src/main/kotlin/de/maibornwolff/codecharta/tools/inquirer/util/InputValidator.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package de.maibornwolff.codecharta.tools.inquirer.util | ||
|
||
class InputValidator { | ||
|
||
companion object { | ||
|
||
//TODO what kind of methods do we need here? | ||
// -> create all that are currently needed for the project when integrating kotter into each parser | ||
// | ||
// needed checkers: | ||
// check if the input is an existing file | ||
// check if the input is an existing file or folder (can probably be combined with above function) | ||
// sometimes input is list of files (or folders), check if they are all existing files | ||
// (add more when going through the parsers) | ||
|
||
fun isInputAnExistingFile(): (String) -> Boolean = { input -> | ||
true | ||
} | ||
|
||
fun isInputAnExistingFileOrFolder(): (String) -> Boolean = { input -> | ||
true | ||
} | ||
|
||
// not sure if this one is needed, its currently there for testing | ||
fun isInputBetweenNumbers(minValue: Int, maxValue: Int): (String) -> Boolean = { input -> | ||
val inputNumber = input.toInt() | ||
minValue < inputNumber && inputNumber < maxValue | ||
} | ||
} | ||
|
||
} |
Oops, something went wrong.