#!/bin/bash 
 
# Copyright 2015 Divya Kothari <divya.s.kothari@gmail.com> 
 
[ -f testing.sh ] && . testing.sh

#testing "name" "command" "result" "infile" "stdin" 
testing "cttyhack touch file" "cttyhack touch file && [ -f file ] &&
  echo 'yes'" "yes\n" "" ""
rm -f file*
 
echo "abcdefghijklmnopqrstuvwxyz" > file1
testing "cttyhack cp file new_file" "cttyhack cp file1 file2 &&
  [ -f file1 -a -f file2 ] && cat file1 && cat file2" \
  "abcdefghijklmnopqrstuvwxyz\nabcdefghijklmnopqrstuvwxyz\n" "" ""
rm -f file*
    
echo "abcdefghijklmnopqrstuvwxyz" > file1
testing "cttyhack mv file new_file" "cttyhack mv file1 file2 &&
  [ ! -e file1 -a -f file2 ] && cat file2" \
  "abcdefghijklmnopqrstuvwxyz\n" "" ""
rm -f file*

