#!/bin/sh

. $(dirname $0)/test_helper.sh

fake_package="${0%/*}/fake-package"

test_basic() {
  rc=0
  output=$(debci localtest -b null "$fake_package" 2>&1) || rc=$?
  assertEquals 0 "$rc"
  if [ "$rc" -ne 0 ]; then echo "$output"; fi
}

# This is undocumented and kept as backwards compatibility until salsaci moves on.
test_logs_dir() {
  rc=0
  output=$(debci localtest -b null --logs-dir="$__tmpdir/output" "$fake_package" 2>&1) || rc=$?
  assertEquals 0 "$rc"
  assertTrue "test -d $__tmpdir/output"
  if [ "$rc" -ne 0 ]; then echo "$output"; fi
}

test_output_dir() {
  rc=0
  output=$(debci localtest -b null --output-dir="$__tmpdir/output" "$fake_package" 2>&1) || rc=$?
  assertEquals 0 "$rc"
  assertTrue "test -d $__tmpdir/output"
  if [ "$rc" -ne 0 ]; then echo "$output"; fi
}

. shunit2
