Index: test/mjsunit/tools/profviz.js |
diff --git a/test/mjsunit/getter-in-prototype.js b/test/mjsunit/tools/profviz.js |
similarity index 52% |
copy from test/mjsunit/getter-in-prototype.js |
copy to test/mjsunit/tools/profviz.js |
index 01a3473ba9ea047aa1972eb383ef75836b8becb3..3a14f4e6beb00fd45d1e9b68686a20290474a967 100644 |
--- a/test/mjsunit/getter-in-prototype.js |
+++ b/test/mjsunit/tools/profviz.js |
@@ -25,54 +25,59 @@ |
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
-// Test that exceptions are not thrown when setting properties on object |
-// that have only a getter in a prototype object, except when we are in strict |
-// mode where exceptsions should be thrown. |
+// Load implementations from <project root>/tools. |
+// Files: tools/csvparser.js tools/splaytree.js tools/codemap.js |
+// Files: tools/consarray.js tools/profile.js tools/profile_view.js |
+// Files: tools/logreader.js tools/tickprocessor.js |
+// Files: tools/profviz/composer.js |
+// Env: TEST_FILE_NAME |
-var o = {}; |
-var p = {}; |
-p.__defineGetter__('x', function(){}); |
-p.__defineGetter__(0, function(){}); |
-o.__proto__ = p; |
+assertEquals('string', typeof TEST_FILE_NAME); |
+var path_length = TEST_FILE_NAME.lastIndexOf('/'); |
+if (path_length == -1) { |
+ path_length = TEST_FILE_NAME.lastIndexOf('\\'); |
+} |
+assertTrue(path_length != -1); |
-assertDoesNotThrow("o.x = 42"); |
-assertDoesNotThrow("o[0] = 42"); |
+var path = TEST_FILE_NAME.substr(0, path_length + 1); |
+var input_file = path + "profviz-test.log"; |
+var reference_file = path + "profviz-test.default"; |
-assertThrows(function() { 'use strict'; o.x = 42; }); |
-assertThrows(function() { 'use strict'; o[0] = 42; }); |
+var content_lines = read(input_file).split("\n"); |
+var line_cursor = 0; |
+var output_lines = []; |
-function f() { |
- with(o) { |
- x = 42; |
- } |
+function input() { |
+ return content_lines[line_cursor++]; |
} |
-assertDoesNotThrow(f); |
- |
-__proto__ = p; |
-function g() { |
- eval('1'); |
- x = 42; |
+function output(line) { |
+ output_lines.push(line); |
} |
-function g_strict() { |
- 'use strict'; |
- eval('1'); |
- x = 42; |
+function set_range(start, end) { |
+ range_start = start; |
+ range_end = end; |
} |
-assertDoesNotThrow(g); |
-assertThrows(g_strict); |
+var distortion = 4500 / 1000000; |
+var resx = 1600; |
+var resy = 600; |
-__proto__ = p; |
-function g2() { |
- this[0] = 42; |
-} |
+var psc = new PlotScriptComposer(resx, resy); |
+psc.collectData(input, distortion); |
+psc.findPlotRange(undefined, undefined, set_range); |
+var objects = psc.assembleOutput(output); |
-function g2_strict() { |
- 'use strict'; |
- this[0] = 42; |
-} |
+output("# start: " + range_start); |
+output("# end: " + range_end); |
+output("# objects: " + objects); |
Hannes Payer (out of office)
2013/07/10 07:37:24
would it make sense to assert on expected values f
|
+ |
+var create_baseline = false; |
-assertDoesNotThrow(g2); |
-assertThrows(g2_strict); |
+if (create_baseline) { |
Hannes Payer (out of office)
2013/07/10 07:31:50
looks like create_baseline is always false? or is
|
+ print(JSON.stringify(output_lines, null, 2)); |
+} else { |
+ assertArrayEquals(output_lines, |
+ JSON.parse(read(reference_file))); |
+} |