<commit_before>package com.cloudbees.groovy.cps

import org.codehaus.groovy.control.CompilerConfiguration
import org.codehaus.groovy.control.customizers.ImportCustomizer
import org.junit.Before
import org.junit.Test

/**
 *
 *
 * @author <NAME>
 */
class CpsTransformerTest {
    GroovyShell sh;
    def binding = new Binding()

    @Before
    void setUp() {
        def cc = new CompilerConfiguration()
        cc.addCompilationCustomizers(new ImportCustomizer().addImports(CpsTransformerTest.class.name))
        cc.addCompilationCustomizers(new CpsTransformer())
        sh = new GroovyShell(binding,cc);
    }

    @Test
    void helloWorld() {
        Function f = sh.evaluate("'hello world'.length()")
        def p = f.invoke(null, null, [], Continuation.HALT)

        assert p.resume().yieldedValue()==11;
    }
}<commit_msg>add regular shell on the side<commit_after>package com.cloudbees.groovy.cps

import org.codehaus.groovy.control.CompilerConfiguration
import org.codehaus.groovy.control.customizers.ImportCustomizer
import org.junit.Before
import org.junit.Test

/**
 *
 *
 * @author <NAME>
 */
class CpsTransformerTest {
    /**
     * CPS-transforming shelll
     */
    GroovyShell csh;

    /**
     * Default groovy shell
     */
    GroovyShell sh;

    def binding = new Binding()

    @Before
    void setUp() {
        def imports = new ImportCustomizer().addImports(CpsTransformerTest.class.name)

        def cc = new CompilerConfiguration()
        cc.addCompilationCustomizers(imports)
        cc.addCompilationCustomizers(new CpsTransformer())
        csh = new GroovyShell(binding,cc);

        cc = new CompilerConfiguration()
        cc.addCompilationCustomizers(imports)
        sh = new GroovyShell(binding,cc);
    }

    @Test
    void helloWorld() {
        Script s = csh.parse("'hello world'.length()")
        Function f = s.run();
        def p = f.invoke(null, s, [], Continuation.HALT)

        assert p.resume().yieldedValue()==11;

        assert sh.evaluate("'hello world'.length()")==11;
    }
}
{'fraction_non_alphanumeric': 0.11839530332681017, 'fraction_numerical': 0.0029354207436399216, 'mean_word_length': 2.98635477582846, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '6272412', 'n_tokens_mistral': 657, 'n_tokens_neox': 622, 'n_words': 124}