Permalink
Browse files

fixed asp tests

  • Loading branch information...
smith committed Oct 7, 2009
1 parent e0cf550 commit 0977e71b7d66ed8f72722de0de6cc27dde46687e
Showing with 40 additions and 2,178 deletions.
  1. +2 −0 src/lang/string.js
  2. +2 −18 test/unit/array_test.js
  3. +1 −1 test/unit/asp/array_test.asp
  4. +1 −1 test/unit/asp/class_test.asp
  5. +1 −1 test/unit/asp/date_test.asp
  6. +1 −1 test/unit/asp/enumerable_test.asp
  7. +1 −1 test/unit/asp/function_test.asp
  8. +1 −1 test/unit/asp/hash_test.asp
  9. +1 −1 test/unit/asp/number_test.asp
  10. +1 −1 test/unit/asp/object_test.asp
  11. +1 −1 test/unit/asp/range_test.asp
  12. +1 −1 test/unit/asp/regexp_test.asp
  13. +1 −1 test/unit/asp/string_test.asp
  14. 0 test/unit/asp/tests/.unittest
  15. +0 −194 test/unit/asp/tests/array_test.js
  16. +0 −45 test/unit/asp/tests/base_test.js
  17. +0 −130 test/unit/asp/tests/class_test.js
  18. +0 −5 test/unit/asp/tests/date_test.js
  19. +0 −271 test/unit/asp/tests/enumerable_test.js
  20. +0 −134 test/unit/asp/tests/function_test.js
  21. +0 −178 test/unit/asp/tests/hash_test.js
  22. +0 −44 test/unit/asp/tests/number_test.js
  23. +0 −182 test/unit/asp/tests/object_test.js
  24. +0 −45 test/unit/asp/tests/prototype_test.js
  25. +0 −58 test/unit/asp/tests/range_test.js
  26. +0 −42 test/unit/asp/tests/regexp_test.js
  27. +0 −536 test/unit/asp/tests/string_test.js
  28. +0 −150 test/unit/asp/tests/unittest_test.js
  29. +1 −1 test/unit/asp/unittest_test.asp
  30. +2 −2 test/unit/class_test.js
  31. +2 −2 test/unit/date_test.js
  32. +2 −5 test/unit/enumerable_test.js
  33. +2 −48 test/unit/function_test.js
  34. +2 −2 test/unit/hash_test.js
  35. +2 −2 test/unit/number_test.js
  36. +2 −25 test/unit/object_test.js
  37. +2 −2 test/unit/range_test.js
  38. +2 −2 test/unit/regexp_test.js
  39. +3 −3 test/unit/string_test.js
  40. +3 −41 test/unit/unittest_test.js
View
@@ -491,6 +491,8 @@ Object.extend(String.prototype, (function() {
stripScripts: stripScripts,
extractScripts: extractScripts,
evalScripts: evalScripts,
+ escapeHTML: escapeHTML,
+ unescapeHTML: unescapeHTML,
toQueryParams: toQueryParams,
parseQuery: toQueryParams,
toArray: toArray,
View
@@ -1,6 +1,6 @@
var globalArgsTest = 'nothing to see here';
-new Test.Unit.Runner({
+var testResults = new Test.Unit.Runner({
test$A: function(){
this.assertEnumEqual([], $A({}));
},
@@ -17,22 +17,6 @@ new Test.Unit.Runner({
this.assertEnumEqual(['foo','bar'], globalArgsTest);
},
- testToArrayOnNodeList: function(){
- // direct HTML
- this.assertEqual(3, $A($('test_node').childNodes).length);
-
- // DOM
- var element = document.createElement('div');
- element.appendChild(document.createTextNode('22'));
- (2).times(function(){ element.appendChild(document.createElement('span')) });
- this.assertEqual(3, $A(element.childNodes).length);
-
- // HTML String
- element = document.createElement('div');
- $(element).update('22<span></span><span></span');
- this.assertEqual(3, $A(element.childNodes).length);
- },
-
testToArrayOnPrimitive: function() {
this.assertEnumEqual(['a', 'b', 'c'], $A('abc'));
this.assertEnumEqual([], $A(''));
@@ -193,4 +177,4 @@ new Test.Unit.Runner({
var args = (function() { return [].concat(arguments) })(1, 2);
this.assertIdentical(1, args[0][0]);
}
-});
+});
@@ -9,7 +9,7 @@
<link rel="stylesheet" href="assets/unittest.css" type="text/css" />
- <script src="tests/array_test.js" type="text/javascript" charset="utf-8" language="javascript" runat="server"></script>
+ <script src="../array_test.js" type="text/javascript" charset="utf-8" language="javascript" runat="server"></script>
</head>
<body>
@@ -9,7 +9,7 @@
<link rel="stylesheet" href="assets/unittest.css" type="text/css" />
<script src="fixtures/class.js" type="text/javascript" charset="utf-8" language="javascript" runat="server"></script>
- <script src="tests/class_test.js" type="text/javascript" charset="utf-8" language="javascript" runat="server"></script>
+ <script src="../class_test.js" type="text/javascript" charset="utf-8" language="javascript" runat="server"></script>
</head>
<body>
@@ -9,7 +9,7 @@
<link rel="stylesheet" href="assets/unittest.css" type="text/css" />
- <script src="tests/date_test.js" type="text/javascript" charset="utf-8" language="javascript" runat="server"></script>
+ <script src="../date_test.js" type="text/javascript" charset="utf-8" language="javascript" runat="server"></script>
</head>
<body>
@@ -9,7 +9,7 @@
<link rel="stylesheet" href="assets/unittest.css" type="text/css" />
<script src="fixtures/enumerable.js" type="text/javascript" charset="utf-8" language="javascript" runat="server"></script>
- <script src="tests/enumerable_test.js" type="text/javascript" charset="utf-8" language="javascript" runat="server"></script>
+ <script src="../enumerable_test.js" type="text/javascript" charset="utf-8" language="javascript" runat="server"></script>
</head>
<body>
@@ -9,7 +9,7 @@
<link rel="stylesheet" href="assets/unittest.css" type="text/css" />
<script src="fixtures/function.js" type="text/javascript" charset="utf-8" language="javascript" runat="server"></script>
- <script src="tests/function_test.js" type="text/javascript" charset="utf-8" language="javascript" runat="server"></script>
+ <script src="../function_test.js" type="text/javascript" charset="utf-8" language="javascript" runat="server"></script>
</head>
<body>
@@ -9,7 +9,7 @@
<link rel="stylesheet" href="assets/unittest.css" type="text/css" />
<script src="fixtures/hash.js" type="text/javascript" charset="utf-8" language="javascript" runat="server"></script>
- <script src="tests/hash_test.js" type="text/javascript" charset="utf-8" language="javascript" runat="server"></script>
+ <script src="../hash_test.js" type="text/javascript" charset="utf-8" language="javascript" runat="server"></script>
</head>
<body>
@@ -9,7 +9,7 @@
<link rel="stylesheet" href="assets/unittest.css" type="text/css" />
- <script src="tests/number_test.js" type="text/javascript" charset="utf-8" language="javascript" runat="server"></script>
+ <script src="../number_test.js" type="text/javascript" charset="utf-8" language="javascript" runat="server"></script>
</head>
<body>
@@ -9,7 +9,7 @@
<link rel="stylesheet" href="assets/unittest.css" type="text/css" />
<script src="fixtures/object.js" type="text/javascript" charset="utf-8" language="javascript" runat="server"></script>
- <script src="tests/object_test.js" type="text/javascript" charset="utf-8" language="javascript" runat="server"></script>
+ <script src="../object_test.js" type="text/javascript" charset="utf-8" language="javascript" runat="server"></script>
</head>
<body>
@@ -9,7 +9,7 @@
<link rel="stylesheet" href="assets/unittest.css" type="text/css" />
- <script src="tests/range_test.js" type="text/javascript" charset="utf-8" language="javascript" runat="server"></script>
+ <script src="../range_test.js" type="text/javascript" charset="utf-8" language="javascript" runat="server"></script>
</head>
<body>
@@ -9,7 +9,7 @@
<link rel="stylesheet" href="assets/unittest.css" type="text/css" />
- <script src="tests/regexp_test.js" type="text/javascript" charset="utf-8" language="javascript" runat="server"></script>
+ <script src="../regexp_test.js" type="text/javascript" charset="utf-8" language="javascript" runat="server"></script>
</head>
<body>
@@ -10,7 +10,7 @@
<link rel="stylesheet" href="assets/unittest.css" type="text/css" />
<script src="fixtures/string.js" type="text/javascript" charset="utf-8" language="javascript" runat="server"></script>
- <script src="tests/string_test.js" type="text/javascript" charset="utf-8" language="javascript" runat="server"></script>
+ <script src="../string_test.js" type="text/javascript" charset="utf-8" language="javascript" runat="server"></script>
</head>
<body>
No changes.
@@ -1,194 +0,0 @@
-var globalArgsTest = 'nothing to see here';
-
-var testResults = new Test.Unit.Runner({
- test$A: function(){
- this.assertEnumEqual([], $A({}));
- },
-
- testToArrayOnArguments: function(){
- function toArrayOnArguments(){
- globalArgsTest = $A(arguments);
- }
- toArrayOnArguments();
- this.assertEnumEqual([], globalArgsTest);
- toArrayOnArguments('foo');
- this.assertEnumEqual(['foo'], globalArgsTest);
- toArrayOnArguments('foo','bar');
- this.assertEnumEqual(['foo','bar'], globalArgsTest);
- },
-/*
- testToArrayOnNodeList: function(){
- // direct HTML
- this.assertEqual(3, $A($('test_node').childNodes).length);
-
- // DOM
- var element = document.createElement('div');
- element.appendChild(document.createTextNode('22'));
- (2).times(function(){ element.appendChild(document.createElement('span')) });
- this.assertEqual(3, $A(element.childNodes).length);
-
- // HTML String
- element = document.createElement('div');
- $(element).update('22<span></span><span></span');
- this.assertEqual(3, $A(element.childNodes).length);
- },
-*/
- testClear: function(){
- this.assertEnumEqual([], [].clear());
- this.assertEnumEqual([], [1].clear());
- this.assertEnumEqual([], [1,2].clear());
- },
-
- testClone: function(){
- this.assertEnumEqual([], [].clone());
- this.assertEnumEqual([1], [1].clone());
- this.assertEnumEqual([1,2], [1,2].clone());
- this.assertEnumEqual([0,1,2], [0,1,2].clone());
- var a = [0,1,2];
- var b = a;
- this.assertIdentical(a, b);
- b = a.clone();
- this.assertNotIdentical(a, b);
- },
-
- testFirst: function(){
- this.assertUndefined([].first());
- this.assertEqual(1, [1].first());
- this.assertEqual(1, [1,2].first());
- },
-
- testLast: function(){
- this.assertUndefined([].last());
- this.assertEqual(1, [1].last());
- this.assertEqual(2, [1,2].last());
- },
-
- testCompact: function(){
- this.assertEnumEqual([], [].compact());
- this.assertEnumEqual([1,2,3], [1,2,3].compact());
- this.assertEnumEqual([0,1,2,3], [0,null,1,2,undefined,3].compact());
- this.assertEnumEqual([1,2,3], [null,1,2,3,null].compact());
- },
-
- testFlatten: function(){
- this.assertEnumEqual([], [].flatten());
- this.assertEnumEqual([1,2,3], [1,2,3].flatten());
- this.assertEnumEqual([1,2,3], [1,[[[2,3]]]].flatten());
- this.assertEnumEqual([1,2,3], [[1],[2],[3]].flatten());
- this.assertEnumEqual([1,2,3], [[[[[[[1]]]]]],2,3].flatten());
- },
-
- testIndexOf: function(){
- this.assertEqual(-1, [].indexOf(1));
- this.assertEqual(-1, [0].indexOf(1));
- this.assertEqual(0, [1].indexOf(1));
- this.assertEqual(1, [0,1,2].indexOf(1));
- this.assertEqual(0, [1,2,1].indexOf(1));
- this.assertEqual(2, [1,2,1].indexOf(1, -1));
- this.assertEqual(1, [undefined,null].indexOf(null));
- },
-
- testLastIndexOf: function(){
- this.assertEqual(-1,[].lastIndexOf(1));
- this.assertEqual(-1, [0].lastIndexOf(1));
- this.assertEqual(0, [1].lastIndexOf(1));
- this.assertEqual(2, [0,2,4,6].lastIndexOf(4));
- this.assertEqual(3, [4,4,2,4,6].lastIndexOf(4));
- this.assertEqual(3, [0,2,4,6].lastIndexOf(6,3));
- this.assertEqual(-1, [0,2,4,6].lastIndexOf(6,2));
- this.assertEqual(0, [6,2,4,6].lastIndexOf(6,2));
-
- var fixture = [1,2,3,4,3];
- this.assertEqual(4, fixture.lastIndexOf(3));
- this.assertEnumEqual([1,2,3,4,3],fixture);
-
- //tests from http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Objects:Array:lastIndexOf
- var array = [2, 5, 9, 2];
- this.assertEqual(3,array.lastIndexOf(2));
- this.assertEqual(-1,array.lastIndexOf(7));
- this.assertEqual(3,array.lastIndexOf(2,3));
- this.assertEqual(0,array.lastIndexOf(2,2));
- this.assertEqual(0,array.lastIndexOf(2,-2));
- this.assertEqual(3,array.lastIndexOf(2,-1));
- },
-
- testInspect: function(){
- this.assertEqual('[]',[].inspect());
- this.assertEqual('[1]',[1].inspect());
- this.assertEqual('[\'a\']',['a'].inspect());
- this.assertEqual('[\'a\', 1]',['a',1].inspect());
- },
-
- testIntersect: function(){
- this.assertEnumEqual([1,3], [1,1,3,5].intersect([1,2,3]));
- this.assertEnumEqual([1], [1,1].intersect([1,1]));
- this.assertEnumEqual([], [1,1,3,5].intersect([4]));
- this.assertEnumEqual([], [1].intersect(['1']));
-
- this.assertEnumEqual(
- ['B','C','D'],
- $R('A','Z').toArray().intersect($R('B','D').toArray())
- );
- },
-
- testToJSON: function(){
- this.assertEqual('[]', [].toJSON());
- this.assertEqual('[\"a\"]', ['a'].toJSON());
- this.assertEqual('[\"a\", 1]', ['a', 1].toJSON());
- this.assertEqual('[\"a\", {\"b\": null}]', ['a', {'b': null}].toJSON());
- },
-
- testReduce: function(){
- this.assertUndefined([].reduce());
- this.assertNull([null].reduce());
- this.assertEqual(1, [1].reduce());
- this.assertEnumEqual([1,2,3], [1,2,3].reduce());
- this.assertEnumEqual([1,null,3], [1,null,3].reduce());
- },
-
- testReverse: function(){
- this.assertEnumEqual([], [].reverse());
- this.assertEnumEqual([1], [1].reverse());
- this.assertEnumEqual([2,1], [1,2].reverse());
- this.assertEnumEqual([3,2,1], [1,2,3].reverse());
- },
-
- testSize: function(){
- this.assertEqual(4, [0, 1, 2, 3].size());
- this.assertEqual(0, [].size());
- },
-
- testUniq: function(){
- this.assertEnumEqual([1], [1, 1, 1].uniq());
- this.assertEnumEqual([1], [1].uniq());
- this.assertEnumEqual([], [].uniq());
- this.assertEnumEqual([0, 1, 2, 3], [0, 1, 2, 2, 3, 0, 2].uniq());
- this.assertEnumEqual([0, 1, 2, 3], [0, 0, 1, 1, 2, 3, 3, 3].uniq(true));
- },
-
- testWithout: function(){
- this.assertEnumEqual([], [].without(0));
- this.assertEnumEqual([], [0].without(0));
- this.assertEnumEqual([1], [0,1].without(0));
- this.assertEnumEqual([1,2], [0,1,2].without(0));
- },
-
- test$w: function(){
- this.assertEnumEqual(['a', 'b', 'c', 'd'], $w('a b c d'));
- this.assertEnumEqual([], $w(' '));
- this.assertEnumEqual([], $w(''));
- this.assertEnumEqual([], $w(null));
- this.assertEnumEqual([], $w(undefined));
- this.assertEnumEqual([], $w());
- this.assertEnumEqual([], $w(10));
- this.assertEnumEqual(['a'], $w('a'));
- this.assertEnumEqual(['a'], $w('a '));
- this.assertEnumEqual(['a'], $w(' a'));
- this.assertEnumEqual(['a', 'b', 'c', 'd'], $w(' a b\nc\t\nd\n'));
- },
-
- testConcat: function(){
- var args = (function() { return [].concat(arguments) })(1, 2);
- this.assertIdentical(1, args[0][0]);
- }
-});
@@ -1,45 +0,0 @@
-var testResults = new Test.Unit.Runner({
-/*
- testBrowserDetection: function() {
- var results = $H(Prototype.Browser).map(function(engine){
- return engine;
- }).partition(function(engine){
- return engine[1] === true
- });
- var trues = results[0], falses = results[1];
-
- this.info('User agent string is: ' + navigator.userAgent);
-
- this.assert(trues.size() == 0 || trues.size() == 1,
- 'There should be only one or no browser detected.');
-
- // we should have definite trues or falses here
- trues.each(function(result) {
- this.assert(result[1] === true);
- }, this);
- falses.each(function(result) {
- this.assert(result[1] === false);
- }, this);
-
- if(navigator.userAgent.indexOf('AppleWebKit/') > -1) {
- this.info('Running on WebKit');
- this.assert(Prototype.Browser.WebKit);
- }
-
- if(!!window.opera) {
- this.info('Running on Opera');
- this.assert(Prototype.Browser.Opera);
- }
-
- if(!!(window.attachEvent && !window.opera)) {
- this.info('Running on IE');
- this.assert(Prototype.Browser.IE);
- }
-
- if(navigator.userAgent.indexOf('Gecko') > -1 && navigator.userAgent.indexOf('KHTML') == -1) {
- this.info('Running on Gecko');
- this.assert(Prototype.Browser.Gecko);
- }
- }
-*/
-});
Oops, something went wrong.

0 comments on commit 0977e71

Please sign in to comment.