|
1 /* |
|
2 * WARNING! |
|
3 * |
|
4 * Do not edit this file directly, it is built from the sources at |
|
5 * https://github.com/mozilla/source-map/ |
|
6 */ |
|
7 |
|
8 Components.utils.import('resource://test/Utils.jsm'); |
|
9 /* -*- Mode: js; js-indent-level: 2; -*- */ |
|
10 /* |
|
11 * Copyright 2011 Mozilla Foundation and contributors |
|
12 * Licensed under the New BSD license. See LICENSE or: |
|
13 * http://opensource.org/licenses/BSD-3-Clause |
|
14 */ |
|
15 define("test/source-map/test-base64", ["require", "exports", "module"], function (require, exports, module) { |
|
16 |
|
17 var base64 = require('source-map/base64'); |
|
18 |
|
19 exports['test out of range encoding'] = function (assert, util) { |
|
20 assert.throws(function () { |
|
21 base64.encode(-1); |
|
22 }); |
|
23 assert.throws(function () { |
|
24 base64.encode(64); |
|
25 }); |
|
26 }; |
|
27 |
|
28 exports['test out of range decoding'] = function (assert, util) { |
|
29 assert.throws(function () { |
|
30 base64.decode('='); |
|
31 }); |
|
32 }; |
|
33 |
|
34 exports['test normal encoding and decoding'] = function (assert, util) { |
|
35 for (var i = 0; i < 64; i++) { |
|
36 assert.equal(base64.decode(base64.encode(i)), i); |
|
37 } |
|
38 }; |
|
39 |
|
40 }); |
|
41 function run_test() { |
|
42 runSourceMapTests('test/source-map/test-base64', do_throw); |
|
43 } |