From b019f3ee29ce55c3d515ee8bafe0f4bb14221c0a Mon Sep 17 00:00:00 2001 From: Péter Szilágyi Date: Thu, 11 Feb 2016 16:16:52 +0200 Subject: Godeps: update all dependencies to latest code --- .../robertkrimen/otto/underscore_utility_test.go | 419 --------------------- 1 file changed, 419 deletions(-) delete mode 100644 Godeps/_workspace/src/github.com/robertkrimen/otto/underscore_utility_test.go (limited to 'Godeps/_workspace/src/github.com/robertkrimen/otto/underscore_utility_test.go') diff --git a/Godeps/_workspace/src/github.com/robertkrimen/otto/underscore_utility_test.go b/Godeps/_workspace/src/github.com/robertkrimen/otto/underscore_utility_test.go deleted file mode 100644 index ebabb083b..000000000 --- a/Godeps/_workspace/src/github.com/robertkrimen/otto/underscore_utility_test.go +++ /dev/null @@ -1,419 +0,0 @@ -package otto - -import ( - "testing" -) - -// #750 - Return _ instance. -func Test_underscore_utility_0(t *testing.T) { - tt(t, func() { - test, _ := test_() - - test(` - test("#750 - Return _ instance.", 2, function() { - var instance = _([]); - ok(_(instance) === instance); - ok(new _(instance) === instance); - }); - `) - }) -} - -// identity -func Test_underscore_utility_1(t *testing.T) { - tt(t, func() { - test, _ := test_() - - test(` - test("identity", function() { - var moe = {name : 'moe'}; - equal(_.identity(moe), moe, 'moe is the same as his identity'); - }); - `) - }) -} - -// random -func Test_underscore_utility_2(t *testing.T) { - tt(t, func() { - test, _ := test_() - - test(` - test("random", function() { - var array = _.range(1000); - var min = Math.pow(2, 31); - var max = Math.pow(2, 62); - - ok(_.every(array, function() { - return _.random(min, max) >= min; - }), "should produce a random number greater than or equal to the minimum number"); - - ok(_.some(array, function() { - return _.random(Number.MAX_VALUE) > 0; - }), "should produce a random number when passed "); - }); - `) - }) -} - -// uniqueId -func Test_underscore_utility_3(t *testing.T) { - tt(t, func() { - test, _ := test_() - - test(` - test("uniqueId", function() { - var ids = [], i = 0; - while(i++ < 100) ids.push(_.uniqueId()); - equal(_.uniq(ids).length, ids.length, 'can generate a globally-unique stream of ids'); - }); - `) - }) -} - -// times -func Test_underscore_utility_4(t *testing.T) { - tt(t, func() { - test, _ := test_() - - test(` - test("times", function() { - var vals = []; - _.times(3, function (i) { vals.push(i); }); - ok(_.isEqual(vals, [0,1,2]), "is 0 indexed"); - // - vals = []; - _(3).times(function(i) { vals.push(i); }); - ok(_.isEqual(vals, [0,1,2]), "works as a wrapper"); - // collects return values - ok(_.isEqual([0, 1, 2], _.times(3, function(i) { return i; })), "collects return values"); - }); - `) - }) -} - -// mixin -func Test_underscore_utility_5(t *testing.T) { - tt(t, func() { - test, _ := test_() - - test(` - test("mixin", function() { - _.mixin({ - myReverse: function(string) { - return string.split('').reverse().join(''); - } - }); - equal(_.myReverse('panacea'), 'aecanap', 'mixed in a function to _'); - equal(_('champ').myReverse(), 'pmahc', 'mixed in a function to the OOP wrapper'); - }); - `) - }) -} - -// _.escape -func Test_underscore_utility_6(t *testing.T) { - tt(t, func() { - test, _ := test_() - - test(` - test("_.escape", function() { - equal(_.escape("Curly & Moe"), "Curly & Moe"); - equal(_.escape("Curly & Moe"), "Curly &amp; Moe"); - equal(_.escape(null), ''); - }); - `) - }) -} - -// _.unescape -func Test_underscore_utility_7(t *testing.T) { - tt(t, func() { - test, _ := test_() - - test(` - test("_.unescape", function() { - var string = "Curly & Moe"; - equal(_.unescape("Curly & Moe"), string); - equal(_.unescape("Curly &amp; Moe"), "Curly & Moe"); - equal(_.unescape(null), ''); - equal(_.unescape(_.escape(string)), string); - }); - `) - }) -} - -// template -func Test_underscore_utility_8(t *testing.T) { - tt(t, func() { - test, _ := test_() - - test(` - test("template", function() { - var basicTemplate = _.template("<%= thing %> is gettin' on my noives!"); - var result = basicTemplate({thing : 'This'}); - equal(result, "This is gettin' on my noives!", 'can do basic attribute interpolation'); - - var sansSemicolonTemplate = _.template("A <% this %> B"); - equal(sansSemicolonTemplate(), "A B"); - - var backslashTemplate = _.template("<%= thing %> is \\ridanculous"); - equal(backslashTemplate({thing: 'This'}), "This is \\ridanculous"); - - var escapeTemplate = _.template('<%= a ? "checked=\\"checked\\"" : "" %>'); - equal(escapeTemplate({a: true}), 'checked="checked"', 'can handle slash escapes in interpolations.'); - - var fancyTemplate = _.template(""); - result = fancyTemplate({people : {moe : "Moe", larry : "Larry", curly : "Curly"}}); - equal(result, "", 'can run arbitrary javascript in templates'); - - var escapedCharsInJavascriptTemplate = _.template(""); - result = escapedCharsInJavascriptTemplate({numbers: "one\ntwo\nthree\nfour"}); - equal(result, "", 'Can use escaped characters (e.g. \\n) in Javascript'); - - var namespaceCollisionTemplate = _.template("<%= pageCount %> <%= thumbnails[pageCount] %> <% _.each(thumbnails, function(p) { %>
\">
<% }); %>"); - result = namespaceCollisionTemplate({ - pageCount: 3, - thumbnails: { - 1: "p1-thumbnail.gif", - 2: "p2-thumbnail.gif", - 3: "p3-thumbnail.gif" - } - }); - equal(result, "3 p3-thumbnail.gif
"); - - var noInterpolateTemplate = _.template("

Just some text. Hey, I know this is silly but it aids consistency.

"); - result = noInterpolateTemplate(); - equal(result, "

Just some text. Hey, I know this is silly but it aids consistency.

"); - - var quoteTemplate = _.template("It's its, not it's"); - equal(quoteTemplate({}), "It's its, not it's"); - - var quoteInStatementAndBody = _.template("<%\ - if(foo == 'bar'){ \ - %>Statement quotes and 'quotes'.<% } %>"); - equal(quoteInStatementAndBody({foo: "bar"}), "Statement quotes and 'quotes'."); - - var withNewlinesAndTabs = _.template('This\n\t\tis: <%= x %>.\n\tok.\nend.'); - equal(withNewlinesAndTabs({x: 'that'}), 'This\n\t\tis: that.\n\tok.\nend.'); - - var template = _.template("<%- value %>"); - var result = template({value: "