⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 makenewtest.sh

📁 linux 下的源代码分析阅读器 red hat公司新版
💻 SH
字号:
# A script that helps create an empty test shell# application.# The only parameter is the name of the class.# The output file will be in the src/com/sleepycat/db/test# directory.case $1 in*Test);;*)  echo "New test case names must end in Test."  exit 1;;esacoutdir="src/com/sleepycat/db/test"if [ ! -d $outdir ]then  echo "Could not find test source directory. Ensure the script is being run from the right place."  exit 1fioutname="$outdir/$1.java"if [ -f $outname ]then  echo "A test with that file name exists."  echo -n "Are you sure you want to overwrite the file (yes/no)? "  read got_ok  if [ $got_ok != "yes" ]  then    exit 1  else    echo "" > $outname  fifinameupper=`echo $1 | tr -t [:lower:] [:upper:]`namelower=`echo $1 | tr -t [:upper:] [:lower:]`echo "/*-" >> $outnameecho " * See the file LICENSE for redistribution information." >> $outnameecho " * " >> $outnameecho " * Copyright (c) 2002,2007 Oracle.  All rights reserved." >> $outnameecho " *" >> $outnameecho " */" >> $outnameecho "" >> $outnameecho "" >> $outnameecho "package com.sleepycat.db.test;" >> $outnameecho "" >> $outnameecho "import org.junit.After;" >> $outnameecho "import org.junit.AfterClass;" >> $outnameecho "import org.junit.Before;" >> $outnameecho "import org.junit.BeforeClass;" >> $outnameecho "import org.junit.Test;" >> $outnameecho "import static org.junit.Assert.assertEquals;" >> $outnameecho "import static org.junit.Assert.fail;" >> $outnameecho "" >> $outnameecho "import com.sleepycat.db.*;" >> $outnameecho "" >> $outname# some other likely ones :)echo "import java.io.File;" >> $outnameecho "import java.io.FileNotFoundException;" >> $outnameecho "import java.io.IOException;" >> $outnameecho "" >> $outnameecho "import com.sleepycat.db.test.TestUtils;" >> $outnameecho "public class $1 {" >> $outnameecho "    public static final String ${nameupper}_DBNAME = \"${namelower}.db\";" >> $outnameecho "    @BeforeClass public static void ClassInit() {" >> $outnameecho "        TestUtils.loadConfig(null);" >> $outnameecho -n "        TestUtils.check_file_removed(TestUtils." >> $outnameecho "getDBFileName(${nameupper}_DBNAME), true, true);" >> $outnameecho -n "        TestUtils.removeall(true, true, TestUtils." >> $outnameecho "BASETEST_DBDIR, TestUtils.getDBFileName(${nameupper}_DBNAME));" >> $outnameecho "    }" >> $outnameecho "" >> $outnameecho "    @AfterClass public static void ClassShutdown() {" >> $outnameecho -n "        TestUtils.check_file_removed(TestUtils." >> $outnameecho "getDBFileName(${nameupper}_DBNAME), true, true);" >> $outnameecho -n "        TestUtils.removeall(true, true, TestUtils." >> $outnameecho "BASETEST_DBDIR, TestUtils.getDBFileName(${nameupper}_DBNAME));" >> $outnameecho "    }" >> $outnameecho "" >> $outnameecho "    @Before public void PerTestInit()" >> $outnameecho "        throws Exception {" >> $outnameecho "    }" >> $outnameecho "" >> $outnameecho "    @After public void PerTestShutdown()" >> $outnameecho "        throws Exception {" >> $outnameecho "    }" >> $outnameecho "    /*" >> $outnameecho "     * Test case implementations." >> $outnameecho "     * To disable a test mark it with @Ignore" >> $outnameecho "     * To set a timeout(ms) notate like: @Test(timeout=1000)" >> $outnameecho "     * To indicate an expected exception notate like: $Test(expected=Exception)" >> $outnameecho "     */" >> $outnameecho "" >> $outnameecho "    @Test public void test1()" >> $outnameecho "        throws DatabaseException, FileNotFoundException" >> $outnameecho "    {" >> $outnameecho "    }" >> $outnameecho "}" >> $outname

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -