Sha256: 8bbfc70849aa0cc621471bd9ff84a0ebf06422218fa3d17c6a950d1b07f3d412

Contents?: true

Size: 1.89 KB

Versions: 268

Compression:

Stored size: 1.89 KB

Contents

#!/usr/bin/env bash

set -e

source test/setup

use Test::More


export round=0
test_round() {
  clone-foo-and-bar

  round=$(( round + 1 ))
  normalize_dir="$1"
  normalize_dir="${normalize_dir#./}"
  normalize_dir="${normalize_dir%/}"
  while [[ $normalize_dir =~ (//+) ]]; do normalize_dir=${normalize_dir//${BASH_REMATCH[1]}/\/}; done

  clone_output="$(
    cd $OWNER/foo
    git subrepo clone ../../../$UPSTREAM/bar -- "$normalize_dir"
  )"

  # Check output is correct:
  is "$clone_output" \
    "Subrepo '../../../tmp/upstream/bar' (master) cloned into '$normalize_dir'." \
    'subrepo clone command output is correct'

  test-exists "$OWNER/foo/$normalize_dir/"

  (
    cd $OWNER/bar
    git pull
    add-new-files Bar2-$round
    git push
  ) &> /dev/null || die

  # Do the pull and check output:
  {
    is "$(
       cd $OWNER/foo
       git subrepo pull -- "$normalize_dir"
       )" \
       "Subrepo '$normalize_dir' pulled from '../../../tmp/upstream/bar' (master)." \
       'subrepo pull command output is correct'
  }

  test-exists "$OWNER/foo/$normalize_dir/"

  (
    cd "$OWNER/foo/$normalize_dir"
    git pull
    add-new-files new-$round
    git push
  ) &> /dev/null || die

  # Do the push and check output:
  {
    is "$(
       cd $OWNER/foo
       git subrepo push -- "$normalize_dir"
       )" \
       "Subrepo '$normalize_dir' pushed to '../../../tmp/upstream/bar' (master)." \
       'subrepo push command output is correct'
  }
}

test_round normal
test_round .dot
test_round ......dots
test_round 'spa ce'
test_round 'per%cent'
test_round 'back-sl\ash'
test_round 'end-with.lock'
test_round '@'
test_round '@{'
test_round '['
test_round '-begin-with-minus'
test_round 'tailing-slash/'
test_round 'tailing-dots...'
test_round 'special-char:^[?*'
test_round 'many////slashes'
test_round '_under_scores_'

test_round '.str%a\nge...'
test_round '~////......s:a^t?r a*n[g@{e.lock'

done_testing

teardown

Version data entries

268 entries across 268 versions & 4 rubygems

Version Path
eac_tools-0.86.5 sub/eac_git/vendor/git-subrepo/test/encode.t
eac_tools-0.86.4 sub/eac_git/vendor/git-subrepo/test/encode.t
eac_tools-0.86.3 sub/eac_git/vendor/git-subrepo/test/encode.t
eac_git-0.16.0 vendor/git-subrepo/test/encode.t
eac_tools-0.86.2 sub/eac_git/vendor/git-subrepo/test/encode.t
eac_git-0.15.0 vendor/git-subrepo/test/encode.t
eac_tools-0.84.2 sub/eac_git/vendor/git-subrepo/test/encode.t
eac_tools-0.84.1 sub/eac_git/vendor/git-subrepo/test/encode.t
eac_tools-0.84.0 sub/eac_git/vendor/git-subrepo/test/encode.t
eac_tools-0.83.0 sub/eac_git/vendor/git-subrepo/test/encode.t
eac_tools-0.82.0 sub/eac_git/vendor/git-subrepo/test/encode.t
eac_tools-0.81.0 sub/eac_git/vendor/git-subrepo/test/encode.t
eac_tools-0.80.0 sub/eac_git/vendor/git-subrepo/test/encode.t
eac_tools-0.79.0 sub/eac_git/vendor/git-subrepo/test/encode.t
eac_tools-0.78.0 sub/eac_git/vendor/git-subrepo/test/encode.t
eac_tools-0.77.1 sub/eac_git/vendor/git-subrepo/test/encode.t
eac_tools-0.77.0 sub/eac_git/vendor/git-subrepo/test/encode.t
eac_tools-0.76.1 sub/eac_git/vendor/git-subrepo/test/encode.t
eac_tools-0.76.0 sub/eac_git/vendor/git-subrepo/test/encode.t
eac_tools-0.75.2 sub/eac_git/vendor/git-subrepo/test/encode.t