<commit_before>package tests;

import tools.haxelib.Os;
import tools.haxelib.Habal;
import tools.haxelib.Package;
import tools.haxelib.Config;

import utest.Assert;

class TestParse {

  public static var testFile = "./test.hbl";

  var hbl:Habal;
  var conf:Config;

  public function new() {}
  
  public
  function setup() {
    hbl = HblTools.process(testFile);
    conf = HblTools.getConfig(hbl);
  }
  
  public function
  testGlobals() {
    var globals = conf.globals();
    Assert.isFalse(globals == null);
    Assert.equals(globals.synopsis,"freeform");
    Assert.equals(globals.name,"project-name");
    Assert.isTrue(Std.is(globals.tags,Array));

  }

  public function
  testLibrary() {
    var library = conf.library();
    Assert.equals(library,null);
    Assert.isTrue(Std.is(library.sourceDirs,Array));
    Assert.equals("/home/blackdog/Projects/haxelib/src",library.sourceDirs[0]);
  }


  public
  function testExecutable() {
    var exe = conf.executable();
    Assert.isFalse(exe == null);
    Assert.equals("filename (required)",exe.mainIs);
    Assert.equals("foo",exe.attrs[0]);
  }

  public
  function testRepo() {
    var repo = conf.repo();
    Assert.isFalse(repo == null);
    Assert.equals("this",repo.attrs[0]);
    Assert.equals("darcs",repo.type);

    //    trace(JSON.encode(conf));
  }
}

class PackageTests  {
  var hbl:Habal;
  var conf:Config;

  public function new() {}
  
  public
  function setup() {
    // initialises package dir, process habal
    Package.initPackDir();
    hbl = HblTools.process(TestParse.testFile);
    conf = HblTools.getConfig(hbl);<commit_msg>woops fix failing test<commit_after>package tests;

import tools.haxelib.Os;
import tools.haxelib.Habal;
import tools.haxelib.Package;
import tools.haxelib.Config;

import utest.Assert;

class TestParse {

  public static var testFile = "./test.hbl";

  var hbl:Habal;
  var conf:Config;

  public function new() {}
  
  public
  function setup() {
    hbl = HblTools.process(testFile);
    conf = HblTools.getConfig(hbl);
  }
  
  public function
  testGlobals() {
    var globals = conf.globals();
    Assert.notNull(globals);
    Assert.equals(globals.synopsis,"freeform");
    Assert.equals(globals.name,"project-name");
    Assert.isTrue(Std.is(globals.tags,Array));

  }

  public function
  testLibrary() {
    var library = conf.library();
    Assert.notNull(library);
    Assert.isTrue(Std.is(library.sourceDirs,Array));
    Assert.equals("/home/blackdog/Projects/haxelib/src",library.sourceDirs[0]);
  }


  public
  function testExecutable() {
    var exe = conf.executable();
    Assert.notNull(exe);
    Assert.equals("filename (required)",exe.mainIs);
    Assert.equals("foo",exe.attrs[0]);
  }

  public
  function testRepo() {
    var repo = conf.repo();
    Assert.notNull(repo);
    Assert.equals("this",repo.attrs[0]);
    Assert.equals("darcs",repo.type);

    //    trace(JSON.encode(conf));
  }
}

class PackageTests  {
  var hbl:Habal;
  var conf:Config;

  public function new() {}
  
  public
  function setup() {
    // initialises package dir, process habal
    Package.initPackDir();
    hbl = HblTools.process(TestParse.testFile);
    conf = HblTools.getConfig(hbl);
{'fraction_non_alphanumeric': 0.1436584605796198, 'fraction_numerical': 0.001869741352446245, 'mean_word_length': 3.546742209631728, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '1503863', 'n_tokens_mistral': 1126, 'n_tokens_neox': 1093, 'n_words': 193}