UNPKG

sku-pg

Version:

Skulpt is a Javascript implementation of Python 2.x. Python that runs in your browser!

66 lines (54 loc) 1.63 kB
<!DOCTYPE html> <html> <!-- Copyright 2011 The Closure Library Authors. All Rights Reserved. Use of this source code is governed by the Apache License, Version 2.0. See the COPYING file for details. --> <!-- --> <head> <title>Closure Unit Tests - goog.testing.fs.Blob</title> <script src="../../base.js"></script> <script> goog.require('goog.testing.fs.Blob'); goog.require('goog.testing.jsunit'); </script> </head> <body> <script> function testAttributes() { var blob = new goog.testing.fs.Blob(); assertEquals(0, blob.size); assertEquals('', blob.type); blob = new goog.testing.fs.Blob('foo bar baz'); assertEquals(11, blob.size); assertEquals('', blob.type); blob = new goog.testing.fs.Blob('foo bar baz', 'text/plain'); assertEquals(11, blob.size); assertEquals('text/plain', blob.type); } function testToString() { assertEquals('', new goog.testing.fs.Blob().toString()); assertEquals('foo bar', new goog.testing.fs.Blob('foo bar').toString()); } function testSlice() { var blob = new goog.testing.fs.Blob('abcdef'); assertEquals('bc', blob.slice(1, 2).toString()); assertEquals('def', blob.slice(3, 10).toString()); assertEquals('', blob.slice(10, 1).toString()); assertEquals('a', blob.slice(-1, 1).toString()); assertEquals('text/plain', blob.slice(1, 2, 'text/plain').type); } function testSetDataInternal() { var blob = new goog.testing.fs.Blob(); blob.setDataInternal('asdf'); assertEquals('asdf', blob.toString()); assertEquals(4, blob.size); blob.setDataInternal(''); assertEquals('', blob.toString()); assertEquals(0, blob.size); } </script> </body> </html>