Package

Source Code of BasicRubyFormatTest

/*
* Name:    BasicRubyFormatTest
* Authors: Richard Rodger
* Release: 0.3
*
* Copyright (c) 2000-2002 Richard Rodger
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published
* by the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/


// package
// none


/* Import << */
import org.jostraca.util.FileUtil;
import org.jostraca.util.PropertySet;

import junit.framework.TestCase;
import junit.framework.TestSuite;
import junit.textui.TestRunner;

import java.io.PrintWriter;
import java.io.File;
/* Import >> */


/** <b>Description:</b><br>
*  Test cases for BasicRubyFormat
*/
public class BasicRubyFormatTest extends BasicFormatTestSupport {

  public static final boolean RUN_ONLY_COMMENTED_OUT = false;


  public static final String RUBY_FOLDER           = "ruby";
  public static final String RUBY_TEMPLATE_SUFFIX  = "_rb.jtm";


  public BasicRubyFormatTest( String rName ) {
    super( rName );
  }

  public static TestSuite suite() {
    return new TestSuite( BasicRubyFormatTest.class );
  }

  public static void main( String[] rArgs ) {
    handleArgs( rArgs );
    TestRunner.run( suite() );
  }


  public String getTestFolder() {
    return RUBY_FOLDER;
  }


  public String getJostracaCodeWriterFileName() {
    return "Writer.rb";
  }


  /* Test Methods << */


  public void testMethodInsert() throws Exception {
    if( RUN_ONLY_COMMENTED_OUT ) { return; }
    generateTemplate( TEST_MethodInsert );
    assertTrue( validateMethodInsert() );

    PropertySet        testPS = getTestPS();
    PropertySet refPS  = getReferencePS();
    refPS.clear();

    refPS.set("boolean""false");
    assertTrue( testPS.contains( refPS ) );
  }

  /* Test Methods >> */



  /* Protected Methods << */

  protected String makeCMDForTemplate( String  rTemplateNameSansSuffix,
                                       String  rExtraJostracaArgs,
                                       String  rCodeWriterArgs,
                                       boolean rSetOutputFolder
                                     ) {

    String codeWriterArgs = "";
    if( 0 < rCodeWriterArgs.length() ) {
      codeWriterArgs = rCodeWriterArgs;
    }

   
    String templateName     = PREFIX_TEST + rTemplateNameSansSuffix + RUBY_TEMPLATE_SUFFIX;
    File   templateFilePath = new File( RUBY_FOLDER, templateName );

    String setOutputFolder = "";
    if( rSetOutputFolder ) {
      setOutputFolder = " " + "-o " + getTestFolder();
    }


    String cmd             
      = getJostracaCmd()
      + " " + "-gB "
      //+ " " + "-Djostraca.support.ForceScriptByPath=yes"
      + setOutputFolder
      + " " + rExtraJostracaArgs
      + " " + templateFilePath.getPath()
      + " " + codeWriterArgs;

    return cmd;
  }

  /* Protected Methods >> */

TOP

Related Classes of BasicRubyFormatTest

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.