On 1/31/2019 6:41 PM, Junio C Hamano wrote:
SZEDER Gábor <szeder.dev@xxxxxxxxx> writes:
On Wed, Jan 30, 2019 at 12:56:34PM -0800, Jeff Hostetler via GitGitGadget wrote:
Create unit tests for Trace2.
diff --git a/t/t0212-trace2-event.sh b/t/t0212-trace2-event.sh
new file mode 100755
index 0000000000..517d5514df
--- /dev/null
+++ b/t/t0212-trace2-event.sh
@@ -0,0 +1,234 @@
+test_expect_success 'event stream, return code 0' '
+ test_when_finished "rm trace.event actual expect" &&
+ GIT_TR2_EVENT="$(pwd)/trace.event" test-tool trace2 004child test-tool trace2 004child test-tool trace2 001return 0 &&
+ perl "$TEST_DIRECTORY/t0212/parse_events.perl" <trace.event >actual &&
+ sed -e "s/^|//" >expect <<-EOF &&
+ |VAR1 = {
+ | "_SID0_":{
+ | "argv":[
+ | "_EXE_",
+ | "trace2",
+ | "004child",
+ | "test-tool",
+ | "trace2",
+ | "004child",
+ | "test-tool",
+ | "trace2",
+ | "001return",
+ | "0"
+ | ],
+ | "child":{
+ | "0":{
+ | "child_argv":[
+ | "_EXE_",
+ | "trace2",
+ | "004child",
+ | "test-tool",
+ | "trace2",
+ | "001return",
+ | "0"
+ | ],
Just curious about the vertically aligned '|'s: are they there to
circumvent 'git diff's big red whitespace warnings on these deeply
indented lines?
I suspect that the reason is some of the lines have 8-spaces or more
after '|', that can be tabified, but when tabified, <<-EOF will strip
that second and subsequent tabs.
Yes, the TAB BAR prefixes are to avoid the red whitespace warnings
and indicate the exact whitespace in actual output and avoid the
effects of the <<-EOF. This technique has been used before in other
tests. See t0019 and t1502.
Jeff