t / perf / p0000-perf-lib-sanity.shon commit Merge branch 'maint' (7f95f2d)
   1#!/bin/sh
   2
   3test_description='Tests whether perf-lib facilities work'
   4. ./perf-lib.sh
   5
   6test_perf_default_repo
   7
   8test_perf 'test_perf_default_repo works' '
   9        foo=$(git rev-parse HEAD) &&
  10        test_export foo
  11'
  12
  13test_checkout_worktree
  14
  15test_perf 'test_checkout_worktree works' '
  16        wt=$(find . | wc -l) &&
  17        idx=$(git ls-files | wc -l) &&
  18        test $wt -gt $idx
  19'
  20
  21baz=baz
  22test_export baz
  23
  24test_expect_success 'test_export works' '
  25        echo "$foo" &&
  26        test "$foo" = "$(git rev-parse HEAD)" &&
  27        echo "$baz" &&
  28        test "$baz" = baz
  29'
  30
  31test_perf 'export a weird var' '
  32        bar="weird # variable" &&
  33        test_export bar
  34'
  35
  36test_expect_success 'test_export works with weird vars' '
  37        echo "$bar" &&
  38        test "$bar" = "weird # variable"
  39'
  40
  41test_perf 'important variables available in subshells' '
  42        test -n "$HOME" &&
  43        test -n "$TEST_DIRECTORY" &&
  44        test -n "$TRASH_DIRECTORY" &&
  45        test -n "$GIT_BUILD_DIR"
  46'
  47
  48test_perf 'test-lib-functions correctly loaded in subshells' '
  49        : >a &&
  50        test_path_is_file a &&
  51        : >b &&
  52        test_cmp a b
  53'
  54
  55test_done