aboutsummaryrefslogtreecommitdiff
path: root/lib/test/data_test.go
AgeCommit message (Collapse)Author
2026-01-15all: convert license and copyright to use SPDX identifiersShulhan
With help of spdxconv tool [1], we able to bulk update all files license and copyright format to comply with SPDX formats. [1] https://kilabit.info/project/spdxconv/
2022-07-25lib/test: truncate the last new line at the end of input and outputShulhan
Given the following input and output, >>> input <<< output EOF The input and output content always have new line at the end. This may cause unexpected input or output. If input or output content expecting new line at the end, add two empty lines at the end of it.
2022-07-22lib/test: implement Data, a type to load formatted file for helping testShulhan
Data contains predefined input and output values that is loaded from file to be used during test. The data provides zero or more flags, an optional description, zero or more input, and zero or more output. The data file name must end with ".txt". The data content use the following format, [FLAG_KEY ":" FLAG_VALUE LF] [LF DESCRIPTION] ">>>" [INPUT_NAME] LF INPUT_CONTENT LF "<<<" [OUTPUT_NAME] LF OUTPUT_CONTENT The data can contains zero or more flag. A flag is key and value separated by ":". The flag key must not contain spaces. The data may contain description. The line that start with "\n>>>" defined the beginning of input. An input can have a name, if its empty it will be set to "default". An input can be defined multiple times, with different names. The line that start with "\n<<<" defined the beginning of output. An output can have a name, if its empty it will be set to "default". An output also can be defined multiple times, with different names.