<commit_before>//  Gant -- A Groovy build framework based on scripting Ant tasks.
//
//  Copyright © 2006-8 <NAME>
//
//  Licensed 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.

package org.codehaus.gant.tests ;

import java.util.List ;

import java.io.ByteArrayOutputStream ;
import java.io.PrintStream ;
import java.io.StringBufferInputStream ;

import groovy.util.GroovyTestCase ;

import gant.Gant ;

/**
 *  A Gant test case: Adds the required input stream manipulation features to avoid replication of code.
 *  Also prepare a new instance of Gant for each test.
 *
 *  @author <NAME> <<EMAIL>>
 */
public abstract class GantTestCase extends GroovyTestCase {
  private ByteArrayOutputStream output ;
  private PrintStream savedOut ;
  protected Gant gant ;
  protected String script ;
  protected void setUp ( ) {
    savedOut = System.out ;
    output = new ByteArrayOutputStream ( ) ;
    System.setOut ( new PrintStream ( output ) ) ;
    gant = new Gant ( "-" ) ;
    script = "" ;
  }
  protected void tearDown ( ) { System.setOut ( savedOut ) ; }
  protected void setScript ( final String script ) { System.setIn ( new StringBufferInputStream ( script ) ) ; }
  protected int processTargets ( ) { return gant.processTargets ( ) ; }
  protected int processTargets ( final String s ) { return gant.processTargets ( s ) ; }
  protected int processTargets ( final List l ) { return gant.processTargets ( l ) ; }  
  protected String getOutput ( ) { return output.toString ( ).replace ( "\r" , "" ) ; }
}
<commit_msg>Switch from using StringBufferInputStream to ByteArrayInputStream so as to avoid the deprecation warning.<commit_after>//  Gant -- A Groovy build framework based on scripting Ant tasks.
//
//  Copyright © 2006-8 <NAME>
//
//  Licensed 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.

package org.codehaus.gant.tests ;

import java.util.List ;

import java.io.ByteArrayInputStream ;
import java.io.ByteArrayOutputStream ;
import java.io.PrintStream ;

import groovy.util.GroovyTestCase ;

import gant.Gant ;

/**
 *  A Gant test case: Adds the required input stream manipulation features to avoid replication of code.
 *  Also prepare a new instance of Gant for each test.
 *
 *  @author <NAME> <<EMAIL>>
 */
public abstract class GantTestCase extends GroovyTestCase {
  private ByteArrayOutputStream output ;
  private PrintStream savedOut ;
  protected Gant gant ;
  protected String script ;
  protected void setUp ( ) {
    savedOut = System.out ;
    output = new ByteArrayOutputStream ( ) ;
    System.setOut ( new PrintStream ( output ) ) ;
    gant = new Gant ( "-" ) ;
    script = "" ;
  }
  protected void tearDown ( ) { System.setOut ( savedOut ) ; }
  protected void setScript ( final String script ) { System.setIn ( new ByteArrayInputStream ( script.getBytes ( ) ) ) ; }
  protected int processTargets ( ) { return gant.processTargets ( ) ; }
  protected int processTargets ( final String s ) { return gant.processTargets ( s ) ; }
  protected int processTargets ( final List l ) { return gant.processTargets ( l ) ; }  
  protected String getOutput ( ) { return output.toString ( ).replace ( "\r" , "" ) ; }
}

{'fraction_non_alphanumeric': 0.09427121102248005, 'fraction_numerical': 0.00435097897026831, 'mean_word_length': 3.425668449197861, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2011504', 'n_tokens_mistral': 1158, 'n_tokens_neox': 1136, 'n_words': 442}