THIS IS A TEST INSTANCE ONLY! REPOSITORIES CAN BE DELETED AT ANY TIME!

Git Source Code Mirror - This is a publish-only repository and all pull requests are ignored. Please follow Documentation/SubmittingPatches procedure for any of your improvements.
git
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

103 line
1.2KB

  1. #!/bin/sh
  2. test_description='test oidmap'
  3. . ./test-lib.sh
  4. # This purposefully is very similar to t0011-hashmap.sh
  5. test_oidmap () {
  6. echo "$1" | test-tool oidmap $3 >actual &&
  7. echo "$2" >expect &&
  8. test_cmp expect actual
  9. }
  10. test_expect_success 'setup' '
  11. test_commit one &&
  12. test_commit two &&
  13. test_commit three &&
  14. test_commit four
  15. '
  16. test_expect_success 'put' '
  17. test_oidmap "put one 1
  18. put two 2
  19. put invalidOid 4
  20. put three 3" "NULL
  21. NULL
  22. Unknown oid: invalidOid
  23. NULL"
  24. '
  25. test_expect_success 'replace' '
  26. test_oidmap "put one 1
  27. put two 2
  28. put three 3
  29. put invalidOid 4
  30. put two deux
  31. put one un" "NULL
  32. NULL
  33. NULL
  34. Unknown oid: invalidOid
  35. 2
  36. 1"
  37. '
  38. test_expect_success 'get' '
  39. test_oidmap "put one 1
  40. put two 2
  41. put three 3
  42. get two
  43. get four
  44. get invalidOid
  45. get one" "NULL
  46. NULL
  47. NULL
  48. 2
  49. NULL
  50. Unknown oid: invalidOid
  51. 1"
  52. '
  53. test_expect_success 'remove' '
  54. test_oidmap "put one 1
  55. put two 2
  56. put three 3
  57. remove one
  58. remove two
  59. remove invalidOid
  60. remove four" "NULL
  61. NULL
  62. NULL
  63. 1
  64. 2
  65. Unknown oid: invalidOid
  66. NULL"
  67. '
  68. test_expect_success 'iterate' '
  69. test_oidmap "put one 1
  70. put two 2
  71. put three 3
  72. iterate" "NULL
  73. NULL
  74. NULL
  75. $(git rev-parse two) 2
  76. $(git rev-parse one) 1
  77. $(git rev-parse three) 3"
  78. '
  79. test_done