<commit_before>( function _File_path_test_ss_( ) {

'use strict';

if( typeof module !== 'undefined' )
{

  require( '../Files.ss' );

  var _ = wTools;

  _.include( 'wTesting' );

}

//

var _ = wTools;
var Parent = wTools.Testing;

//

function fileRecord( test )
{

  var path = '/file/deck/minimal/minimal.coord';

  debugger;
  var r = _.fileProvider.fileRecord( path );

  test.identical( r.absolute,path );
  test.identical( r.relative,'./minimal.coord' );

  test.identical( r.ext,'coord' );
  test.identical( r.extWithDot,'.coord' );

  test.identical( r.name,'minimal' );
  test.identical( r.nameWithExt,'minimal.coord' );

}

// --
// proto
// --

var Self =
{

  name : 'FileRecord',

  tests :
  {

    fileRecord : fileRecord,

  },

}

Self = wTestSuite( Self )
if( typeof module !== 'undefined' && !module.parent )
_.Testing.test( Self.name );

} )( );<commit_msg>fileRecord tests update<commit_after>( function _File_path_test_ss_( ) {

'use strict';

if( typeof module !== 'undefined' )
{

  require( '../Files.ss' );

  var _ = wTools;

  _.include( 'wTesting' );

}

//

var _ = wTools;
var Parent = wTools.Testing;

//

function fileRecord( test )
{

  var path = '/file/deck/minimal/minimal.coord';

  debugger;
  var r = _.fileProvider.fileRecord( path );

  test.identical( r.absolute,path );
  test.identical( r.relative,'./minimal.coord' );

  test.identical( r.ext,'coord' );
  test.identical( r.extWithDot,'.coord' );

  test.identical( r.name,'minimal' );
  test.identical( r.nameWithExt,'minimal.coord' );

  //

  var dir = _.pathRealMainDir();
  var fileRecord = _.fileProvider.fileRecord;
  var pathFile,got;
  var o = { fileProvider :  _.fileProvider };

  function check( got, path, o )
  {
    var pathName = _.pathName( path );
    var ext = _.pathExt( path );
    var stat = _.fileProvider.fileStat( path );

    test.identical( got.absolute, path );

    if( o && o.dir === path )
    test.identical( got.relative, './.' );
    else
    test.identical( got.relative, './' + pathName + '.' + ext );

    test.identical( got.ext, ext );
    test.identical( got.extWithDot, '.' + ext );

    test.identical( got.name, pathName );
    test.identical( got.nameWithExt, pathName + '.' + ext );

    if( stat )
    test.identical( got.stat.size, stat.size );
    else
    test.identical( got.stat, null );
  }

  //

  test.description = 'dir option';
  var recordOptions = _.FileRecordOptions( o, { dir : dir } );

  /*absolute path, not exist*/

  pathFile = _.pathJoin( dir, 'invalid.txt' );
  var got = fileRecord( pathFile,recordOptions );
  check( got, pathFile );

  /*absolute path, terminal file*/

  pathFile = _.pathRealMainFile();
  var got = fileRecord( pathFile,recordOptions );
  check( got, pathFile );

  /*absolute path, dir*/

  pathFile = dir;
  var got = fileRecord( pathFile,recordOptions );
  check( got, pathFile,recordOptions );

  /*absolute path, change dir to it root, pathFile - dir*/

  pathFile = dir;
  var recordOptions = _.FileRecordOptions( o, { dir : _.pathDir( dir ) } );
  var got = fileRecord( pathFile,recordOptions );
  check( got, pathFile,recordOptions );
  test.identical( got.stat.isDirectory(), true )

  /*relative path without dir/relative options*/

  pathFile = _.pathRelative( dir, _.pathRealMainFile() );
  var recordOptions = _.FileRecordOptions( o, {} );
  test.shouldThrowErrorSync( function()
  {
    fileRecord( pathFile, recordOptions );
  });

  /*relative path with dir option*/

  pathFile = _.pathRelative( dir, _.pathRealMainFile() );
  var recordOptions = _.FileRecordOptions( o, { dir : dir } );
  var got = fileRecord( pathFile,recordOptions );
  check( got, _.pathRealMainFile(),recordOptions );

  /*relative path with relative option*/

  pathFile = _.pathRelative( dir, _.pathRealMainFile() );
  var recordOptions = _.FileRecordOptions( o, { relative : dir } );
  var got = fileRecord( pathFile,recordOptions );
  check( got, _.pathRealMainFile(),recordOptions );

  /*relative path with dir+relative, relative is root of dir*/

  pathFile = _.pathRelative( dir, _.pathRealMainFile() );
  var recordOptions = _.FileRecordOptions( o, { dir : dir, relative : _.pathDir( dir ) } );
  var got = fileRecord( pathFile,recordOptions );
  test.identical( got.relative, './z.test/Files.record.test.ss' );
  test.identical( _.objectIs( got.stat ), true );

}

// --
// proto
// --

var Self =
{

  name : 'FileRecord',

  tests :
  {

    fileRecord : fileRecord,

  },

}

Self = wTestSuite( Self )
if( typeof module !== 'undefined' && !module.parent )
_.Testing.test( Self.name );

} )( );
{'fraction_non_alphanumeric': 0.16034031413612565, 'fraction_numerical': 0.0, 'mean_word_length': 3.2297047970479706, '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': '3008904', 'n_tokens_mistral': 1573, 'n_tokens_neox': 1512, 'n_words': 361}