Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(936)

Side by Side Diff: test/mjsunit/object-toprimitive.js

Issue 8888006: Make more JS files beter match the coding standard. Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Address review comments Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « test/mjsunit/object-seal.js ('k') | test/mjsunit/optimized-typeof.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 24 matching lines...) Expand all
35 var s1 = String(o1); 35 var s1 = String(o1);
36 assertTrue(typeof n1 == "number"); 36 assertTrue(typeof n1 == "number");
37 assertTrue(typeof s1 == "string"); 37 assertTrue(typeof s1 == "string");
38 38
39 var trace = []; 39 var trace = [];
40 var valueOfValue = 42; 40 var valueOfValue = 42;
41 var toStringValue = "foo"; 41 var toStringValue = "foo";
42 function traceValueOf () { 42 function traceValueOf () {
43 trace.push("vo"); 43 trace.push("vo");
44 return valueOfValue; 44 return valueOfValue;
45 }; 45 }
46 function traceToString() { 46 function traceToString() {
47 trace.push("ts"); 47 trace.push("ts");
48 return toStringValue; 48 return toStringValue;
49 }; 49 }
50 var valueOfFunc = traceValueOf; 50 var valueOfFunc = traceValueOf;
51 var toStringFunc = traceToString; 51 var toStringFunc = traceToString;
52 52
53 var ot = { get toString() { trace.push("gts"); 53 var ot = { get toString() { trace.push("gts");
54 return toStringFunc; }, 54 return toStringFunc; },
55 get valueOf() { trace.push("gvo"); 55 get valueOf() { trace.push("gvo");
56 return valueOfFunc; } 56 return valueOfFunc; }
57 }; 57 };
58 58
59 var nt = Number(ot); 59 var nt = Number(ot);
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 trace = []; 95 trace = [];
96 assertThrows("String(ot)", TypeError); 96 assertThrows("String(ot)", TypeError);
97 assertEquals(["gts", "gvo"], trace); 97 assertEquals(["gts", "gvo"], trace);
98 98
99 toStringFunc = traceToString; 99 toStringFunc = traceToString;
100 toStringValue = "87"; 100 toStringValue = "87";
101 trace = []; 101 trace = [];
102 var nt = Number(ot); 102 var nt = Number(ot);
103 assertEquals(87, nt); 103 assertEquals(87, nt);
104 assertEquals(["gvo", "gts", "ts"], trace); 104 assertEquals(["gvo", "gts", "ts"], trace);
OLDNEW
« no previous file with comments | « test/mjsunit/object-seal.js ('k') | test/mjsunit/optimized-typeof.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698