<commit_before>//
// Flump - Copyright 2013 Flump Authors

package flump.test {

import flash.filesystem.File;

import flump.export.ExportConf;
import flump.export.JSONFormat;
import flump.export.ProjectConf;
import flump.export.Publisher;
import flump.export.JSONZipFormat;
import flump.export.XMLFormat;
import flump.xfl.XflLibrary;

public class PublishTest
{
    public function PublishTest (runner :TestRunner, lib :XflLibrary) {
        _lib = lib;
        runner.run("Publish XML", makePublishTest("xml", XMLFormat));
        runner.run("Publish JSON", makePublishTest("json", JSONFormat));
        runner.run("Publish JSONZip", makePublishTest("jsonzip", JSONZipFormat,
            function (output :File) :void {  new StarlingResourcesTest(runner, output); }));
    }

    protected function makePublishTest (name :String, formatClass :Class, postPublish :Function=null) :Function {
        return function () :void {
            const exportDir :File = TestRunner.dist.resolvePath("test/publish" + name);
            if (exportDir.exists) exportDir.deleteDirectory(/*deleteDirectoryContents=*/true);
            exportDir.createDirectory();
            const conf :ExportConf = new ExportConf();
            conf.format = formatClass.NAME;
            const project :ProjectConf = new ProjectConf();
            project.exportDir = "starling";
            project.exports = [conf];
            const pub :Publisher = new Publisher(exportDir, project, "Test Project");
            assert(pub.modified(_lib), "Lack of output should indicate modified");
            pub.publish(_lib);
            assert(!pub.modified(_lib), "Shouldn't be modified after publishing");
            if (postPublish != null) {
                postPublish(conf.createPublishFormat(exportDir, _lib)["outputFile"]);
            }
        }
    }

    protected var _lib :XflLibrary;
}
}<commit_msg>Updated the test to new method signatures.<commit_after>//
// Flump - Copyright 2013 Flump Authors

package flump.test {

import flash.filesystem.File;

import flump.export.ExportConf;
import flump.export.JSONFormat;
import flump.export.ProjectConf;
import flump.export.Publisher;
import flump.export.JSONZipFormat;
import flump.export.XMLFormat;
import flump.xfl.XflLibrary;

public class PublishTest
{
    public function PublishTest (runner :TestRunner, lib :XflLibrary) {
        _lib = new <XflLibrary>[lib];
        runner.run("Publish XML", makePublishTest("xml", XMLFormat));
        runner.run("Publish JSON", makePublishTest("json", JSONFormat));
        runner.run("Publish JSONZip", makePublishTest("jsonzip", JSONZipFormat,
            function (output :File) :void {  new StarlingResourcesTest(runner, output); }));
    }

    protected function makePublishTest (name :String, formatClass :Class,
            postPublish :Function=null) :Function {
        return function () :void {
            const exportDir :File = TestRunner.dist.resolvePath("test/publish" + name);
            if (exportDir.exists) exportDir.deleteDirectory(/*deleteDirectoryContents=*/true);
            exportDir.createDirectory();
            const conf :ExportConf = new ExportConf();
            conf.format = formatClass.NAME;
            const project :ProjectConf = new ProjectConf();
            project.exportDir = "starling";
            project.exports = [conf];
            const pub :Publisher = new Publisher(exportDir, project, "Test Project");
            assert(pub.modified(_lib, 0), "Lack of output should indicate modified");
            pub.publishSingle(_lib[0]);
            assert(!pub.modified(_lib, 0), "Shouldn't be modified after publishing");
            if (postPublish != null) {
                postPublish(
                    conf.createPublishFormat(exportDir, _lib, "Text Project")["outputFile"]);
            }
        }
    }

    protected var _lib :Vector.<XflLibrary>;
}
}
{'fraction_non_alphanumeric': 0.11302780638516993, 'fraction_numerical': 0.0028321318228630276, 'mean_word_length': 3.001029866117405, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, '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': '6711348', 'n_tokens_mistral': 1073, 'n_tokens_neox': 1042, 'n_words': 260}