Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 965 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 976 assertEquals(["c", "d", "a", "b"], strict("a", "b")); | 976 assertEquals(["c", "d", "a", "b"], strict("a", "b")); |
| 977 assertEquals(["c", "d", "c", "d"], nonstrict("a", "b")); | 977 assertEquals(["c", "d", "c", "d"], nonstrict("a", "b")); |
| 978 })(); | 978 })(); |
| 979 | 979 |
| 980 | 980 |
| 981 function CheckPillDescriptor(func, name) { | 981 function CheckPillDescriptor(func, name) { |
| 982 | 982 |
| 983 function CheckPill(pill) { | 983 function CheckPill(pill) { |
| 984 assertEquals("function", typeof pill); | 984 assertEquals("function", typeof pill); |
| 985 assertInstanceof(pill, Function); | 985 assertInstanceof(pill, Function); |
| 986 assertThrows(function() { pill.property = "value"; }, TypeError); | 986 pill.property = "value"; |
| 987 assertEquals(pill.value, undefined); | |
|
Martin Maly
2011/03/21 20:38:35
This is alright. We could also have:
assertThrows
| |
| 987 assertThrows(pill, TypeError); | 988 assertThrows(pill, TypeError); |
| 988 assertEquals(pill.prototype, (function(){}).prototype); | 989 assertEquals(pill.prototype, (function(){}).prototype); |
| 989 var d = Object.getOwnPropertyDescriptor(pill, "prototype"); | 990 var d = Object.getOwnPropertyDescriptor(pill, "prototype"); |
| 990 assertFalse(d.writable); | 991 assertFalse(d.writable); |
| 991 assertFalse(d.configurable); | 992 assertFalse(d.configurable); |
| 992 assertFalse(d.enumerable); | 993 assertFalse(d.enumerable); |
| 993 } | 994 } |
| 994 | 995 |
| 995 var descriptor = Object.getOwnPropertyDescriptor(func, name); | 996 var descriptor = Object.getOwnPropertyDescriptor(func, name); |
| 996 CheckPill(descriptor.get) | 997 CheckPill(descriptor.get) |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1074 CheckPillDescriptor(args, "caller"); | 1075 CheckPillDescriptor(args, "caller"); |
| 1075 CheckPillDescriptor(args, "callee"); | 1076 CheckPillDescriptor(args, "callee"); |
| 1076 | 1077 |
| 1077 args = outer()(17, "value", strict); | 1078 args = outer()(17, "value", strict); |
| 1078 assertEquals(17, args[0]) | 1079 assertEquals(17, args[0]) |
| 1079 assertEquals("value", args[1]) | 1080 assertEquals("value", args[1]) |
| 1080 assertEquals(strict, args[2]); | 1081 assertEquals(strict, args[2]); |
| 1081 CheckPillDescriptor(args, "caller"); | 1082 CheckPillDescriptor(args, "caller"); |
| 1082 CheckPillDescriptor(args, "callee"); | 1083 CheckPillDescriptor(args, "callee"); |
| 1083 })(); | 1084 })(); |
| OLD | NEW |