es5.js 832 B

123456789101112131415161718192021222324252627
  1. /*
  2. * $Id: es5.js,v 0.1 2012/08/23 19:43:17 dankogai Exp dankogai $
  3. *
  4. * use mocha to test me
  5. * http://visionmedia.github.com/mocha/
  6. */
  7. var assert, Base64;
  8. if (this['window'] !== this) {
  9. assert = require("assert");
  10. Base64 = require('../base64.js').Base64;
  11. }
  12. var is = function (a, e, m) {
  13. return function () {
  14. assert.equal(a, e, m)
  15. }
  16. };
  17. if ('extendString' in Base64){
  18. Base64.extendString();
  19. describe('String', function () {
  20. it('.toBase64', is('小飼弾'.toBase64(), '5bCP6aO85by+'));
  21. it('.toBase64', is('小飼弾'.toBase64(true), '5bCP6aO85by-'));
  22. it('.toBase64URI', is('小飼弾'.toBase64URI(), '5bCP6aO85by-'));
  23. it('.fromBase64', is('5bCP6aO85by+'.fromBase64(), '小飼弾'));
  24. it('.fromBase64', is('5bCP6aO85by-'.fromBase64(), '小飼弾'));
  25. });
  26. }