!C99Shell v. 2.5 [PHP 8 Update] [24.05.2025]!

Software: Apache/2.4.41 (Ubuntu). PHP/8.0.30 

uname -a: Linux apirnd 5.4.0-204-generic #224-Ubuntu SMP Thu Dec 5 13:38:28 UTC 2024 x86_64 

uid=33(www-data) gid=33(www-data) groups=33(www-data) 

Safe-mode: OFF (not secure)

/var/www/html/wincloud_gateway/node_modules/switchback/test/   drwxr-xr-x
Free 12.92 GB of 57.97 GB (22.28%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Self remove    Logout    


Viewing file:     next-tick.test.js (4.33 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
/**
 * Module dependencies
 */

var assert = require('assert');
var switchback = require('../lib');

describe('synchronous function w/ a switchback ::', function() {


  var someSynchronousFn = function(foobar, cb) {
    var sb = switchback(cb);
    sb.success('some stuff');
    return sb;
  };


  describe('when that function is called using a traditional node callback', function() {
    it('should ensure that at least one cycle of the event loop has elapsed', function(done) {
      var timer = setTimeout(function() {
        return done(new Error('Should have called the switchback event handlers by now!'));
      }, 5);

      someSynchronousFn({
        blah: 'this other argument doesnt matter',
        blahblah: 'its the callback we care about'
      }, function (err, data) {
        clearTimeout(timer);
        if (err) { return done(err); }
        assert.equal(data, 'some stuff');
        return done();
      });
    });
  });


  describe('when that function is called using a handlers object', function() {

    it('should ensure that at least one cycle of the event loop has elapsed', function(done) {
      var timer = setTimeout(function() {
        return done(new Error('Should have called the switchback event handlers by now!'));
      }, 5);

      someSynchronousFn({
        blah: 'this other argument doesnt matter',
        blahblah: 'its the callback we care about'
      }, {
        error: function(err) {
          clearTimeout(timer);
          return done(err);
        },
        success: function(data) {
          clearTimeout(timer);
          assert.equal(data, 'some stuff');
          return done();
        }
      });
    });

  });


  describe('when that function returns the switchback and relies on its EventEmitter properties', function() {

    it('should ensure that at least one cycle of the event loop has elapsed (to support `.on()` usage)', function(done) {
      var timer = setTimeout(function() {
        return done(new Error('Should have called the switchback event handlers by now!'));
      }, 5);

      someSynchronousFn({
        blah: 'this other argument doesnt matter',
        blahblah: 'its the callback we care about'
      })
      .on('error', function(err) {
        clearTimeout(timer);
        return done(err);
      })
      .on('success', function(data) {
        clearTimeout(timer);
        assert.equal(data, 'some stuff');
        return done();
      });

    });

  });

});


  ////////



describe('synchronous function w/ a switchback + `immediate` set to true ::', function() {


  var someSynchronousFn = function(foobar, cb) {
    var sb = switchback(cb, undefined, undefined, true);
    sb.success('some stuff');
    return sb;
  };


  describe('when that function is called using a traditional node callback', function() {
    it('should NOT wait for one cycle of the event loop', function() {

      var data;
      someSynchronousFn({
        blah: 'this other argument doesnt matter',
        blahblah: 'its the callback we care about'
      }, function (err, _data) {
        if (err) { throw err; }
        data = _data;
      });

      assert.equal(data, 'some stuff');

    });
  });


  describe('when that function is called using a handlers object', function() {

    it('should NOT wait for one cycle of the event loop', function() {

      var data;
      someSynchronousFn({
        blah: 'this other argument doesnt matter',
        blahblah: 'its the callback we care about'
      }, {
        error: function(err) {
          throw err;
        },
        success: function(_data) {
          data = _data;
        }
      });

      assert.equal(data, 'some stuff');

    });

  });


  describe('when that function returns the switchback and relies on its EventEmitter properties', function() {

    it('should fail with an error', function() {

      try {
        someSynchronousFn({
          blah: 'this other argument doesnt matter',
          blahblah: 'its the callback we care about'
        })
        .on('error', function(err) {
          throw new Error('should never get here');
        })
        .on('success', function(data) {
          throw new Error('should never get here');
        });

        throw new Error('should have thrown error when trying to use .on()');
      }
      catch (e) {
        if (e.code !== 'SWITCHBACK:E_USAGE') {
          throw e;
        }
      }

    });

  });


});

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ Read-Only ]

:: Make Dir ::
 
[ Read-Only ]
:: Make File ::
 
[ Read-Only ]

:: Go Dir ::
 
:: Go File ::
 

--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0316 ]--