From 187c38068e1c92aaaa3e39c99f5e097e61d18160 Mon Sep 17 00:00:00 2001 From: libmartinito Date: Fri, 17 Nov 2023 16:49:32 +0800 Subject: [PATCH 1/2] CC-823 updated tester utils --- go.mod | 8 ++++---- go.sum | 8 ++++++++ 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/go.mod b/go.mod index 44f27fb..0c1e67c 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/codecrafters-io/git-tester go 1.20 require ( - github.com/codecrafters-io/tester-utils v0.2.7 + github.com/codecrafters-io/tester-utils v0.2.10 github.com/go-git/go-billy/v5 v5.0.0 github.com/go-git/go-git/v5 v5.0.0 ) @@ -14,12 +14,12 @@ require ( require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/emirpasic/gods v1.12.0 // indirect - github.com/fatih/color v1.15.0 // indirect + github.com/fatih/color v1.16.0 // indirect github.com/go-git/gcfg v1.5.0 // indirect github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect github.com/kevinburke/ssh_config v0.0.0-20190725054713-01f96b0aa0cd // indirect github.com/mattn/go-colorable v0.1.13 // indirect - github.com/mattn/go-isatty v0.0.19 // indirect + github.com/mattn/go-isatty v0.0.20 // indirect github.com/mitchellh/go-homedir v1.1.0 // indirect github.com/mitchellh/go-testing-interface v1.14.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect @@ -28,7 +28,7 @@ require ( github.com/xanzy/ssh-agent v0.2.1 // indirect golang.org/x/crypto v0.0.0-20200302210943-78000ba7a073 // indirect golang.org/x/net v0.0.0-20200301022130-244492dfa37a // indirect - golang.org/x/sys v0.12.0 // indirect + golang.org/x/sys v0.14.0 // indirect gopkg.in/warnings.v0 v0.1.2 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/go.sum b/go.sum index ff7c6f3..e251388 100644 --- a/go.sum +++ b/go.sum @@ -6,6 +6,8 @@ github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPd github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs= github.com/codecrafters-io/tester-utils v0.2.7 h1:PkYNYBrQRwFdw/kt3y1D3duqdiBrj5RYyT9wqJx5W2U= github.com/codecrafters-io/tester-utils v0.2.7/go.mod h1:BeSLyqBpFxUwIm41QlnuRG7ZsabBXWE2Ga3LMFUXAPM= +github.com/codecrafters-io/tester-utils v0.2.10 h1:Xpu6wzgpRpiZPFNGWMRcJXwAZZ0Yb5Mv6IDOR319f+s= +github.com/codecrafters-io/tester-utils v0.2.10/go.mod h1:BeSLyqBpFxUwIm41QlnuRG7ZsabBXWE2Ga3LMFUXAPM= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= @@ -14,6 +16,8 @@ github.com/emirpasic/gods v1.12.0 h1:QAUIPSaCu4G+POclxeqb3F+WPpdKqFGlw36+yOzGlrg github.com/emirpasic/gods v1.12.0/go.mod h1:YfzfFFoVP/catgzJb4IKIqXjX78Ha8FMSDh3ymbK86o= github.com/fatih/color v1.15.0 h1:kOqh6YHBtK8aywxGerMG2Eq3H6Qgoqeo13Bk2Mv/nBs= github.com/fatih/color v1.15.0/go.mod h1:0h5ZqXfHYED7Bhv2ZJamyIOUej9KtShiJESRwBDUSsw= +github.com/fatih/color v1.16.0 h1:zmkK9Ngbjj+K0yRhTVONQh1p/HknKYSlNT+vZCzyokM= +github.com/fatih/color v1.16.0/go.mod h1:fL2Sau1YI5c0pdGEVCbKQbLXB6edEj1ZgiY4NijnWvE= github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc= github.com/gliderlabs/ssh v0.2.2 h1:6zsha5zo/TWhRhwqCD3+EarCAgZ2yN28ipRnGPnwkI0= github.com/gliderlabs/ssh v0.2.2/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aevW3Awn0= @@ -42,6 +46,8 @@ github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovk github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA= github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= +github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= +github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mitchellh/go-testing-interface v1.14.1 h1:jrgshOhYAUVNMAJiKbEu7EqAwgJJ2JqpQmpLJOu07cU= @@ -75,6 +81,8 @@ golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o= golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.14.0 h1:Vz7Qs629MkJkGyHxUlRHizWJRG2j8fbQKjELVSNhy7Q= +golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= From 2ccff9a17859d4871de68e0df80516a23af9e5cd Mon Sep 17 00:00:00 2001 From: libmartinito Date: Fri, 17 Nov 2023 16:49:52 +0800 Subject: [PATCH 2/2] CC-823 updated tests --- internal/test_helpers/fixtures/create_blob | 28 ++++----- internal/test_helpers/fixtures/init | 6 +- internal/test_helpers/fixtures/read_blob | 16 ++--- internal/test_helpers/fixtures/read_tree | 38 ++++++------ internal/test_helpers/fixtures/write_tree | 54 ++++++++--------- .../test_helpers/fixtures/write_tree_fail | 60 +++++++++---------- 6 files changed, 101 insertions(+), 101 deletions(-) diff --git a/internal/test_helpers/fixtures/create_blob b/internal/test_helpers/fixtures/create_blob index 46a01d5..00d736f 100644 --- a/internal/test_helpers/fixtures/create_blob +++ b/internal/test_helpers/fixtures/create_blob @@ -1,23 +1,23 @@ Debug = true -[stage-1] Running tests for Stage #1: init -[stage-1] Running git init +[stage-1] Running tests for Stage #1: init +[stage-1] Running git init [your_program] Initialized git directory -[stage-1] Test passed. +[stage-1] Test passed. -[stage-2] Running tests for Stage #2: read_blob -[stage-2] Running ./your_git.sh init +[stage-2] Running tests for Stage #2: read_blob +[stage-2] Running ./your_git.sh init [your_program] Initialized git directory -[stage-2] Writing sample file -[stage-2] Running ./your_git.sh cat-file -p 32eb24247f1cc0f2aa44da05b849392063a9b9e7 +[stage-2] Writing sample file +[stage-2] Running ./your_git.sh cat-file -p 32eb24247f1cc0f2aa44da05b849392063a9b9e7 [your_program] dumpty dooby doo donkey horsey vanilla -[stage-2] Test passed. +[stage-2] Test passed. -[stage-3] Running tests for Stage #3: create_blob -[stage-3] Running ./your_git.sh init +[stage-3] Running tests for Stage #3: create_blob +[stage-3] Running ./your_git.sh init [your_program] Initialized git directory -[stage-3] Writing sample file -[stage-3] Running ./your_git.sh hash-object -w donkey.txt +[stage-3] Writing sample file +[stage-3] Running ./your_git.sh hash-object -w donkey.txt [your_program] 32eb24247f1cc0f2aa44da05b849392063a9b9e7 -[stage-3] Running git cat-file -p 32eb24247f1cc0f2aa44da05b849392063a9b9e7 -[stage-3] Test passed. +[stage-3] Running git cat-file -p 32eb24247f1cc0f2aa44da05b849392063a9b9e7 +[stage-3] Test passed. diff --git a/internal/test_helpers/fixtures/init b/internal/test_helpers/fixtures/init index 6219ba7..fe378aa 100644 --- a/internal/test_helpers/fixtures/init +++ b/internal/test_helpers/fixtures/init @@ -1,6 +1,6 @@ Debug = true -[stage-1] Running tests for Stage #1: init -[stage-1] Running git init +[stage-1] Running tests for Stage #1: init +[stage-1] Running git init [your_program] Initialized git directory -[stage-1] Test passed. +[stage-1] Test passed. diff --git a/internal/test_helpers/fixtures/read_blob b/internal/test_helpers/fixtures/read_blob index 1c52978..39a41c6 100644 --- a/internal/test_helpers/fixtures/read_blob +++ b/internal/test_helpers/fixtures/read_blob @@ -1,14 +1,14 @@ Debug = true -[stage-1] Running tests for Stage #1: init -[stage-1] Running git init +[stage-1] Running tests for Stage #1: init +[stage-1] Running git init [your_program] Initialized git directory -[stage-1] Test passed. +[stage-1] Test passed. -[stage-2] Running tests for Stage #2: read_blob -[stage-2] Running ./your_git.sh init +[stage-2] Running tests for Stage #2: read_blob +[stage-2] Running ./your_git.sh init [your_program] Initialized git directory -[stage-2] Writing sample file -[stage-2] Running ./your_git.sh cat-file -p 32eb24247f1cc0f2aa44da05b849392063a9b9e7 +[stage-2] Writing sample file +[stage-2] Running ./your_git.sh cat-file -p 32eb24247f1cc0f2aa44da05b849392063a9b9e7 [your_program] dumpty dooby doo donkey horsey vanilla -[stage-2] Test passed. +[stage-2] Test passed. diff --git a/internal/test_helpers/fixtures/read_tree b/internal/test_helpers/fixtures/read_tree index 559cbd5..25db7b1 100644 --- a/internal/test_helpers/fixtures/read_tree +++ b/internal/test_helpers/fixtures/read_tree @@ -1,33 +1,33 @@ Debug = true -[stage-1] Running tests for Stage #1: init -[stage-1] Running git init +[stage-1] Running tests for Stage #1: init +[stage-1] Running git init [your_program] Initialized git directory -[stage-1] Test passed. +[stage-1] Test passed. -[stage-2] Running tests for Stage #2: read_blob -[stage-2] Running ./your_git.sh init +[stage-2] Running tests for Stage #2: read_blob +[stage-2] Running ./your_git.sh init [your_program] Initialized git directory -[stage-2] Writing sample file -[stage-2] Running ./your_git.sh cat-file -p 32eb24247f1cc0f2aa44da05b849392063a9b9e7 +[stage-2] Writing sample file +[stage-2] Running ./your_git.sh cat-file -p 32eb24247f1cc0f2aa44da05b849392063a9b9e7 [your_program] dumpty dooby doo donkey horsey vanilla -[stage-2] Test passed. +[stage-2] Test passed. -[stage-3] Running tests for Stage #3: create_blob -[stage-3] Running ./your_git.sh init +[stage-3] Running tests for Stage #3: create_blob +[stage-3] Running ./your_git.sh init [your_program] Initialized git directory -[stage-3] Writing sample file -[stage-3] Running ./your_git.sh hash-object -w donkey.txt +[stage-3] Writing sample file +[stage-3] Running ./your_git.sh hash-object -w donkey.txt [your_program] 32eb24247f1cc0f2aa44da05b849392063a9b9e7 -[stage-3] Running git cat-file -p 32eb24247f1cc0f2aa44da05b849392063a9b9e7 -[stage-3] Test passed. +[stage-3] Running git cat-file -p 32eb24247f1cc0f2aa44da05b849392063a9b9e7 +[stage-3] Test passed. -[stage-4] Running tests for Stage #4: read_tree -[stage-4] Running ./your_git.sh init +[stage-4] Running tests for Stage #4: read_tree +[stage-4] Running ./your_git.sh init [your_program] Initialized git directory -[stage-4] Writing a tree to git storage.. -[stage-4] Running ./your_git.sh ls-tree --name-only 978c60262a761655b8429dbeb12f7dce351c6cd6 +[stage-4] Writing a tree to git storage.. +[stage-4] Running ./your_git.sh ls-tree --name-only 978c60262a761655b8429dbeb12f7dce351c6cd6 [your_program] humpty [your_program] scooby [your_program] vanilla -[stage-4] Test passed. +[stage-4] Test passed. diff --git a/internal/test_helpers/fixtures/write_tree b/internal/test_helpers/fixtures/write_tree index 5f23202..e0f8239 100644 --- a/internal/test_helpers/fixtures/write_tree +++ b/internal/test_helpers/fixtures/write_tree @@ -1,44 +1,44 @@ Debug = true -[stage-1] Running tests for Stage #1: init -[stage-1] Running git init +[stage-1] Running tests for Stage #1: init +[stage-1] Running git init [your_program] Initialized git directory -[stage-1] Test passed. +[stage-1] Test passed. -[stage-2] Running tests for Stage #2: read_blob -[stage-2] Running ./your_git.sh init +[stage-2] Running tests for Stage #2: read_blob +[stage-2] Running ./your_git.sh init [your_program] Initialized git directory -[stage-2] Writing sample file -[stage-2] Running ./your_git.sh cat-file -p 32eb24247f1cc0f2aa44da05b849392063a9b9e7 +[stage-2] Writing sample file +[stage-2] Running ./your_git.sh cat-file -p 32eb24247f1cc0f2aa44da05b849392063a9b9e7 [your_program] dumpty dooby doo donkey horsey vanilla -[stage-2] Test passed. +[stage-2] Test passed. -[stage-3] Running tests for Stage #3: create_blob -[stage-3] Running ./your_git.sh init +[stage-3] Running tests for Stage #3: create_blob +[stage-3] Running ./your_git.sh init [your_program] Initialized git directory -[stage-3] Writing sample file -[stage-3] Running ./your_git.sh hash-object -w donkey.txt +[stage-3] Writing sample file +[stage-3] Running ./your_git.sh hash-object -w donkey.txt [your_program] 32eb24247f1cc0f2aa44da05b849392063a9b9e7 -[stage-3] Running git cat-file -p 32eb24247f1cc0f2aa44da05b849392063a9b9e7 -[stage-3] Test passed. +[stage-3] Running git cat-file -p 32eb24247f1cc0f2aa44da05b849392063a9b9e7 +[stage-3] Test passed. -[stage-4] Running tests for Stage #4: read_tree -[stage-4] Running ./your_git.sh init +[stage-4] Running tests for Stage #4: read_tree +[stage-4] Running ./your_git.sh init [your_program] Initialized git directory -[stage-4] Writing a tree to git storage.. -[stage-4] Running ./your_git.sh ls-tree --name-only 978c60262a761655b8429dbeb12f7dce351c6cd6 +[stage-4] Writing a tree to git storage.. +[stage-4] Running ./your_git.sh ls-tree --name-only 978c60262a761655b8429dbeb12f7dce351c6cd6 [your_program] humpty [your_program] scooby [your_program] vanilla -[stage-4] Test passed. +[stage-4] Test passed. -[stage-5] Running tests for Stage #5: write_tree -[stage-5] Running ./your_git.sh init +[stage-5] Running tests for Stage #5: write_tree +[stage-5] Running ./your_git.sh init [your_program] Initialized git directory -[stage-5] Creating some files & directories -[stage-5] $ ./your_git.sh write-tree +[stage-5] Creating some files & directories +[stage-5] $ ./your_git.sh write-tree [your_program] 7bba7df6498a0391b69e6343b517c3360b658293 -[stage-5] Reading file at .git/objects/7b/ba7df6498a0391b69e6343b517c3360b658293 -[stage-5] Found git object file written at .git/objects/7b/ba7df6498a0391b69e6343b517c3360b658293. -[stage-5] $ git ls-tree --name-only 7bba7df6498a0391b69e6343b517c3360b658293 -[stage-5] Test passed. +[stage-5] Reading file at .git/objects/7b/ba7df6498a0391b69e6343b517c3360b658293 +[stage-5] Found git object file written at .git/objects/7b/ba7df6498a0391b69e6343b517c3360b658293. +[stage-5] $ git ls-tree --name-only 7bba7df6498a0391b69e6343b517c3360b658293 +[stage-5] Test passed. diff --git a/internal/test_helpers/fixtures/write_tree_fail b/internal/test_helpers/fixtures/write_tree_fail index 087a788..af16193 100644 --- a/internal/test_helpers/fixtures/write_tree_fail +++ b/internal/test_helpers/fixtures/write_tree_fail @@ -1,47 +1,47 @@ Debug = true -[stage-1] Running tests for Stage #1: init -[stage-1] Running git init +[stage-1] Running tests for Stage #1: init +[stage-1] Running git init [your_program] Initialized git directory -[stage-1] Test passed. +[stage-1] Test passed. -[stage-2] Running tests for Stage #2: read_blob -[stage-2] Running ./your_git.sh init +[stage-2] Running tests for Stage #2: read_blob +[stage-2] Running ./your_git.sh init [your_program] Initialized git directory -[stage-2] Writing sample file -[stage-2] Running ./your_git.sh cat-file -p 32eb24247f1cc0f2aa44da05b849392063a9b9e7 +[stage-2] Writing sample file +[stage-2] Running ./your_git.sh cat-file -p 32eb24247f1cc0f2aa44da05b849392063a9b9e7 [your_program] dumpty dooby doo donkey horsey vanilla -[stage-2] Test passed. +[stage-2] Test passed. -[stage-3] Running tests for Stage #3: create_blob -[stage-3] Running ./your_git.sh init +[stage-3] Running tests for Stage #3: create_blob +[stage-3] Running ./your_git.sh init [your_program] Initialized git directory -[stage-3] Writing sample file -[stage-3] Running ./your_git.sh hash-object -w donkey.txt +[stage-3] Writing sample file +[stage-3] Running ./your_git.sh hash-object -w donkey.txt [your_program] 32eb24247f1cc0f2aa44da05b849392063a9b9e7 -[stage-3] Running git cat-file -p 32eb24247f1cc0f2aa44da05b849392063a9b9e7 -[stage-3] Test passed. +[stage-3] Running git cat-file -p 32eb24247f1cc0f2aa44da05b849392063a9b9e7 +[stage-3] Test passed. -[stage-4] Running tests for Stage #4: read_tree -[stage-4] Running ./your_git.sh init +[stage-4] Running tests for Stage #4: read_tree +[stage-4] Running ./your_git.sh init [your_program] Initialized git directory -[stage-4] Writing a tree to git storage.. -[stage-4] Running ./your_git.sh ls-tree --name-only 978c60262a761655b8429dbeb12f7dce351c6cd6 +[stage-4] Writing a tree to git storage.. +[stage-4] Running ./your_git.sh ls-tree --name-only 978c60262a761655b8429dbeb12f7dce351c6cd6 [your_program] humpty [your_program] scooby [your_program] vanilla -[stage-4] Test passed. +[stage-4] Test passed. -[stage-5] Running tests for Stage #5: write_tree -[stage-5] Running ./your_git.sh init +[stage-5] Running tests for Stage #5: write_tree +[stage-5] Running ./your_git.sh init [your_program] Initialized git directory -[stage-5] Creating some files & directories -[stage-5] $ ./your_git.sh write-tree +[stage-5] Creating some files & directories +[stage-5] $ ./your_git.sh write-tree [your_program] ca6496ab067423eec80b85b1b5aeb8882d29963e -[stage-5] Reading file at .git/objects/ca/6496ab067423eec80b85b1b5aeb8882d29963e -[stage-5] Found git object file written at .git/objects/ca/6496ab067423eec80b85b1b5aeb8882d29963e. -[stage-5] Git object file doesn't match official Git implementation. Diff after zlib decompression: -[stage-5]  +[stage-5] Reading file at .git/objects/ca/6496ab067423eec80b85b1b5aeb8882d29963e +[stage-5] Found git object file written at .git/objects/ca/6496ab067423eec80b85b1b5aeb8882d29963e. +[stage-5] Git object file doesn't match official Git implementation. Diff after zlib decompression: +[stage-5]  [stage-5] Expected (bytes 0-100), hexadecimal: | ASCII: [stage-5] 74 72 65 65 20 31 30 30 00 31 30 30 36 34 34 20 68 6f 72 73 | tree 100.100644 hors [stage-5] 65 79 00 b3 bb b4 97 51 ee 2c 31 b7 c5 e1 24 06 5d 0f 38 1b | ey.....Q.,1...$.].8. @@ -55,6 +55,6 @@ Debug = true [stage-5] fe 7a ff 30 34 30 30 30 30 20 68 75 6d 70 74 79 00 39 b2 e8 | .z.040000 humpty.9.. [stage-5] c1 14 4b ba dd 5e a5 a0 d0 85 9c 16 7b 6b fc 73 08 30 34 30 | ..K..^......{k.s.040 [stage-5] 30 30 30 20 6d 6f 6e 6b 65 79 00 a1 e1 d3 c8 39 8b 89 b3 09 | 000 monkey.....9.... -[stage-5]  -[stage-5] Git object file doesn't match official Git implementation -[stage-5] Test failed +[stage-5]  +[stage-5] Git object file doesn't match official Git implementation +[stage-5] Test failed