diff --git a/example/init.js b/example/init.js new file mode 100644 index 0000000..c467c95 --- /dev/null +++ b/example/init.js @@ -0,0 +1,22 @@ +/* + * Licensed to Cloudkick, Inc ('Cloudkick') under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * Cloudkick licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +var fs = require('fs'); + +exports['init'] = function() { + fs.mkdirSync('../example/test-123456', 0655); +}; diff --git a/test/simple.sh b/test/simple.sh old mode 100644 new mode 100755 index 9ea1fb2..4357b29 --- a/test/simple.sh +++ b/test/simple.sh @@ -60,4 +60,20 @@ if [ ! $? -gt 0 ]; then exit 1 fi +# Test init file +FOLDER_EXISTS=0 +rm -rf ${CWD}/example/test-123456 +${CWD}/bin/whiskey --init-file "${CWD}/example/init.js" --tests "${CWD}/example/test-success.js" + +if [ -d ${CWD}/example/test-123456 ]; then + FOLDER_EXISTS=1 +fi + +rm -rf ${CWD}/example/test-123456 + +if [ $? -ne 0 ] || [ ${FOLDER_EXISTS} -ne 1 ]; then + echo "Test should pass but failed." + exit 1 +fi + exit 0