Commits

Anonymous committed 8617e04 Merge

Merge with development (pick up shell-script test files for Version 0.2.7)

Comments (0)

Files changed (4)

Tests/BBI36_CheckTimestampFileExists_Test.sh

+#!/bin/sh
+#::------------------------------------------------------------------------------
+#:: Tests for BitBucket Issue #36 - Quiet Check for Existing Timestamp File.
+#:: The message "*** Error accessing .hgtimestamp file! ***" is too strong.
+#:: The file will be recreated if it is missing.  No message needed.
+#::------------------------------------------------------------------------------
+#:: This test-script creates a temporary test repository,
+#:: creates and addes a single file, and commits the file.
+#::------------------------------------------------------------------------------
+#@echo off
+
+curdir=`pwd`
+casenumber=bbi36
+
+initialize_repodir(){
+  testpath=/tmp/hgtimestamp_tests/test${casenumber}/
+  rm -rf ${testpath}
+  mkdir -p ${testpath}
+  cd ${testpath}
+
+  if [ "${testpath}" != "`pwd`" ]; then
+     echo 'change directory failed'
+     return 2>&- || exit
+  fi
+
+  return 0
+}
+
+
+
+
+echo
+echo ===========================================
+echo Test #1 - New Repository - Commit Normally.
+echo
+echo ----------
+echo Initializing Test Repository...
+
+initialize_repodir
+
+hg init
+echo 'Create file (abc.txt)'
+echo "abc" > abc.txt
+hg add abc.txt
+echo hg commit -m "abc"
+hg commit -m "abc"
+echo
+echo
+echo hg status
+hg status
+echo
+echo --------------------------------------------
+echo CHECK: no error message should be displayed.
+echo 'hg status' result should be empty
+echo ============================================
+cd ${curdir}
+echo 'hit enter' && `read garbage`
+echo
+echo
+echo =============================================
+echo Test #2 - New Repository - Commit w/ --debug.
+echo
+echo ----------
+echo Initializing Test Repository...
+
+initialize_repodir
+
+hg init
+echo 'Create file (abc.txt)'
+echo "abc" > abc.txt
+hg add abc.txt
+echo hg commit -m "abc" --debug
+hg commit -m "abc" --debug
+echo
+echo
+echo hg status
+hg status
+echo
+echo --------------------------------------------
+echo CHECK: no error message should be displayed,
+echo        just a simple notification messages.
+echo 'hg status' result should be empty
+echo ============================================
+cd ${curdir}
+echo 'hit enter' && `read garbage`

Tests/BBI37_SaveOnlyCommittedTimestamps_Test.sh

+#!/bin/sh
+#::------------------------------------------------------------------------------
+#:: Tests for BitBucket Issue #37 - Save Timestamp for Committed Files ONLY.
+#:: When committing specific files, the extension is saving the timestamps of ALL
+#:: files tracked in the repository even if they are not included in the commit.
+#:: It should only be saving timestamps for files included in the commit.
+#::------------------------------------------------------------------------------
+#:: This test-script creates a temporary test repository and adds two files to it.
+#:: * The first test will modify both files and commit only one of them.
+#::    - Only the timestamp for the committed file should be changed.
+#:: * The second test will modify both files and commit without specifying a file.
+#::    - The timestamps for both of the files should be changed.
+#::------------------------------------------------------------------------------
+
+#!/bin/sh
+
+curdir=`pwd`
+casenumber=bbi37
+
+initialize_repodir(){
+  testpath=/tmp/hgtimestamp_tests/test${casenumber}/
+  rm -rf ${testpath}
+  mkdir -p ${testpath}
+  cd ${testpath}
+
+  if [ "${testpath}" != "`pwd`" ]; then
+     echo 'change directory failed'
+     return 2>&- || exit
+  fi
+
+  return 0
+}
+
+initialize_repodir
+
+#@echo off
+echo Initializing Test Repository...
+#if exist testrepo rmdir /S /Q testrepo
+#mkdir testrepo
+#cd testrepo
+hg init
+echo 'Create first file (abc.txt)'
+echo "abc" > abc.txt
+hg add abc.txt
+hg commit -m "abc"
+echo 'Create second file (bcd.txt)'
+echo "abc" > bcd.txt
+hg add bcd.txt
+hg commit -m "add bcd"
+echo
+echo ============================================
+echo Test #1: Modify both files, commit only one.
+echo
+echo ----------
+echo Timestamps before changes
+cat .hgtimestamp
+echo "abc" >> abc.txt
+echo "efg" >> bcd.txt
+echo
+echo
+echo hg commit -m "commit bcd only" bcd.txt
+hg commit -m "commit bcd only" bcd.txt
+echo
+echo ----------
+echo Timestamps after committing only bcd.txt
+cat .hgtimestamp
+echo
+echo
+echo hg status
+hg status
+echo
+echo ------------------------------------------------------
+echo CHECK: ONLY the bcd.txt timestamp should have changed.
+echo 'hg status' result should show abc.txt as Modified \(M\)
+echo ======================================================
+echo 'hit enter' && `read garbage`
+echo
+echo
+echo ==============================================
+echo Test #2: Modify both files, commit everything.
+echo
+echo ----------
+echo Timestamps before commit
+cat .hgtimestamp
+echo "123" >> abc.txt
+echo "456" >> bcd.txt
+echo
+echo
+echo hg commit -m "commit all (no match)"
+hg commit -m "commit all (no match)"
+echo
+echo ----------
+echo Timestamps after committing with no Match
+cat .hgtimestamp
+echo
+echo
+echo hg status
+hg status
+echo
+echo -------------------------------------------
+echo CHECK: BOTH timestamps should have changed.
+echo 'hg status' result should be empty
+echo ===========================================
+cd ${curdir}
+echo 'hit enter' && `read garbage`

Tests/BBI38_EmptyUpdate_Test.sh

+#!/bin/sh
+#::------------------------------------------------------------------------------
+#:: Tests for BitBucket Issue #38 - Read JSON File with no Timestamp data.
+#:: The _read_TimestampJSONRecords function fails and returns an error when 
+#:: updating to a revision that has no timestamp data recorded.
+#::------------------------------------------------------------------------------
+#:: This test-script creates a temporary test repository,
+#:: creates and addes a single file, and commits the file.
+#:: The file is then removed and the removal is committed.
+#:: Finally, the Working directory is updated to both revisions.
+#::------------------------------------------------------------------------------
+#@echo off
+curdir=`pwd`
+casenumber=bbi38
+
+initialize_repodir(){
+	testpath=/tmp/hgtimestamp_tests/test${casenumber}/
+	rm -rf ${testpath}
+	mkdir -p ${testpath}
+	cd ${testpath}
+	if [ "`pwd`" != "${testpath}" ]; then
+		return 2>&- || exit
+	fi
+
+	return 0
+}
+
+initialize_repodir
+
+echo
+echo Initializing Test Repository...
+hg init
+echo 'Create file (abc.txt)'
+echo "abc" > abc.txt
+hg add abc.txt
+echo hg commit -m "add abc.txt"
+hg commit -m "add abc.txt"
+echo hg remove abc.txt
+hg remove abc.txt
+echo hg commit -m "remove abc.txt"
+hg commit -m "remove abc.txt"
+echo
+echo =============================================
+echo Test #1 - Update to Rev-0 and Rev-1 normally.
+echo
+echo ----------
+echo hg update 0
+hg update 0
+echo
+echo
+echo hg update 1
+hg update 1
+echo
+echo ----------------------------------------------
+echo CHECK: no error messages should be displayed. 
+echo It should not try to open .hgtimestamp as CSV.
+echo ==============================================
+echo 'hit enter' && `read garbage`
+echo
+echo
+echo ===============================================
+echo Test #2 - Update to Rev-0 and Rev-1 w/ --debug.
+echo
+echo ----------
+echo hg update 0 --debug
+hg update 0 --debug
+echo
+echo
+echo hg update 1 --debug
+hg update 1 --debug
+echo
+echo ---------------------------------------------
+echo CHECK: no error messages should be displayed.
+echo It should not try to open .hgtimestamp as CSV.
+echo =============================================
+cd ${curdir}
+echo 'hit enter' && `read garbage`

Tests/BBI40_LINUX_TEST.sh

+#!/bin/sh
+#::------------------------------------------------------------------------------
+#:: Tests for BitBucket Issue #40 - Linux Compatability.
+#:: This is a simple functional test to ensure the extension commits timestamps
+#:: and modified/added files correctly.  This is similar to the test for BBI#36.
+#::------------------------------------------------------------------------------
+#:: This test-script creates a temporary test repository,
+#:: creates and addes a single file, and commits the file.
+#::------------------------------------------------------------------------------
+#@echo off
+
+curdir=`pwd`
+casenumber=bbi40
+
+initialize_repodir(){
+	testpath=/tmp/hgtimestamp_tests/test${casenumber}/
+	rm -rf ${testpath}
+	mkdir -p ${testpath}
+	cd ${testpath}
+	if [ "`pwd`" != "${testpath}" ]; then
+		return 2>&- || exit
+	fi
+
+	return 0
+}
+
+echo
+echo ===========================================
+echo Test #1 - New Repository - Commit Normally.
+echo
+echo ----------
+echo Initializing Test Repository...
+initialize_repodir
+hg init
+echo 'Create file (abc.txt)'
+echo "abc" > abc.txt
+hg add abc.txt
+echo hg commit -m "abc"
+hg commit -m "abc"
+echo
+echo --------------------------------------------
+echo CHECK: no error message should be displayed.
+echo ============================================
+echo 'hit enter' && `read garbage`
+echo
+echo hg status
+hg status
+echo
+echo hg manifest
+hg manifest
+echo
+echo
+echo cat .hgtimestamp
+cat .hgtimestamp
+echo
+echo --------------------------------------------
+echo CHECK: 
+echo   'hg status' result should be empty
+echo   Manifest should contain ".hgtimestamp" and "testfile"
+echo   .hgtimestamp should contain "testfile" entry
+echo ============================================
+cd ${curdir}
+echo 'hit enter' && `read garbage`
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.