| Age | Commit message (Collapse) | Author |
|
Using diff Unified improve the test output readability when two large
strings are not match.
|
|
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/
|
|
There are several reasons that why we move from github.com.
First, related to the name of package.
We accidentally name the package with "share" a common word in English
that does not reflect the content of repository.
By moving to other repository, we can rename it to better and unique
name, in this "pakakeh.go".
Pakakeh is Minang word for tools, and ".go" suffix indicate that the
repository related to Go programming language.
Second, supporting open source.
The new repository is hosted under sourcehut.org, the founder is known
to support open source, and all their services are licensed under AGPL,
unlike GitHub that are closed sources.
Third, regarding GitHub CoPilot.
The GitHub Terms of Service [1], allow any public content that are hosted
there granted them to parse the content.
On one side, GitHub helps and flourish the open source, but on another
side have an issues regarding scraping the copyleft license [2].
[1]: https://docs.github.com/en/site-policy/github-terms/github-terms-of-service#4-license-grant-to-us
[2]: https://githubcopilotinvestigation.com
|
|
This reduce the struct size from 24 to 16 bytes (-8).
|
|
The name TestWriter is considered stutter if its called from external
package, test.TestWriter.
While at it, implement the Error and Errorf in BufferWriter and add
comment to each exported methods.
|
|
This example show expected, got, and diff between them.
|
|
The idea is to prevent using non-exported function in example.
Case in point, in this changes the testWriter is used in example and
not exported which make our test not runnable on public website.
To fix that we export TestWriter with this changes.
|
|
In the output, instead of using %q we replace it with %s, because printing
string with double quote cause escaping and hard to read
This change may cause difference in white spaces not showed in the
terminal.
In the diff changes, only print the Old and New, without printing each
chunk.
|
|
If both exp and got types are string and its longer than 50 chars, it
will use the text/diff.Text to show the difference between them.
The diff output is as follow,
!!! string not matched:
--++
<LINE_NUM> - "<LINE_EXP>"
<LINE_NUM> + "<LINE_GOT>"
^<COL_NUM> - "<DELETED_STRING>"
^<COL_NUM> + "<INSERTED_STRING>"
The "<LINE_NUM> - " print the line number in exp followed by line itself.
The "<LINE_NUM> + " print the line number in got followed by line itself.
The "^<COL_NUM> - " show the character number in exp line followed by
deleted string (or string that not exist in got).
The "^<COL_NUM> + " show the character number in got line followed by
inserted string (or string that not exist in exp).
|
|
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.
|
|
This is to make the list of files being tested is consistent.
|
|
Previously, the LoadDataDir load all files from directory that have
".txt" extension.
This may cause unknown non-test data files loaded and may cause an error.
To distinguish it with other text files, inside the directory to be loaded
load only the file that has suffix "_test.txt".
|
|
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.
|