order-of-operations.js (3183B)
1 // |reftest| skip-if(!this.hasOwnProperty('Temporal')) -- Temporal is not enabled unconditionally 2 // Copyright (C) 2022 Igalia, S.L. All rights reserved. 3 // This code is governed by the BSD license found in the LICENSE file. 4 5 /*--- 6 esid: sec-temporal.zoneddatetime.compare 7 description: Properties on objects passed to compare() are accessed in the correct order 8 includes: [compareArray.js, temporalHelpers.js] 9 features: [Temporal] 10 ---*/ 11 12 const expected = [ 13 "get one.calendar", 14 // PrepareTemporalFields 15 "get one.day", 16 "get one.day.valueOf", 17 "call one.day.valueOf", 18 "get one.hour", 19 "get one.hour.valueOf", 20 "call one.hour.valueOf", 21 "get one.microsecond", 22 "get one.microsecond.valueOf", 23 "call one.microsecond.valueOf", 24 "get one.millisecond", 25 "get one.millisecond.valueOf", 26 "call one.millisecond.valueOf", 27 "get one.minute", 28 "get one.minute.valueOf", 29 "call one.minute.valueOf", 30 "get one.month", 31 "get one.month.valueOf", 32 "call one.month.valueOf", 33 "get one.monthCode", 34 "get one.monthCode.toString", 35 "call one.monthCode.toString", 36 "get one.nanosecond", 37 "get one.nanosecond.valueOf", 38 "call one.nanosecond.valueOf", 39 "get one.offset", 40 "get one.offset.toString", 41 "call one.offset.toString", 42 "get one.second", 43 "get one.second.valueOf", 44 "call one.second.valueOf", 45 "get one.timeZone", 46 "get one.year", 47 "get one.year.valueOf", 48 "call one.year.valueOf", 49 // Same set of operations, for the other argument: 50 "get two.calendar", 51 // PrepareTemporalFields 52 "get two.day", 53 "get two.day.valueOf", 54 "call two.day.valueOf", 55 "get two.hour", 56 "get two.hour.valueOf", 57 "call two.hour.valueOf", 58 "get two.microsecond", 59 "get two.microsecond.valueOf", 60 "call two.microsecond.valueOf", 61 "get two.millisecond", 62 "get two.millisecond.valueOf", 63 "call two.millisecond.valueOf", 64 "get two.minute", 65 "get two.minute.valueOf", 66 "call two.minute.valueOf", 67 "get two.month", 68 "get two.month.valueOf", 69 "call two.month.valueOf", 70 "get two.monthCode", 71 "get two.monthCode.toString", 72 "call two.monthCode.toString", 73 "get two.nanosecond", 74 "get two.nanosecond.valueOf", 75 "call two.nanosecond.valueOf", 76 "get two.offset", 77 "get two.offset.toString", 78 "call two.offset.toString", 79 "get two.second", 80 "get two.second.valueOf", 81 "call two.second.valueOf", 82 "get two.timeZone", 83 "get two.year", 84 "get two.year.valueOf", 85 "call two.year.valueOf", 86 ]; 87 const actual = []; 88 89 const one = TemporalHelpers.propertyBagObserver(actual, { 90 year: 2001, 91 month: 5, 92 monthCode: "M05", 93 day: 2, 94 hour: 6, 95 minute: 54, 96 second: 32, 97 millisecond: 987, 98 microsecond: 654, 99 nanosecond: 321, 100 offset: "+00:00", 101 calendar: "iso8601", 102 timeZone: "UTC", 103 }, "one", ["calendar", "timeZone"]); 104 105 const two = TemporalHelpers.propertyBagObserver(actual, { 106 year: 2014, 107 month: 7, 108 monthCode: "M07", 109 day: 19, 110 hour: 12, 111 minute: 34, 112 second: 56, 113 millisecond: 123, 114 microsecond: 456, 115 nanosecond: 789, 116 offset: "+00:00", 117 calendar: "iso8601", 118 timeZone: "UTC", 119 }, "two", ["calendar", "timeZone"]); 120 121 Temporal.ZonedDateTime.compare(one, two); 122 assert.compareArray(actual, expected, "order of operations"); 123 124 reportCompare(0, 0);