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

Side by Side Diff: test/cctest/test-regexp.cc

Issue 1846303002: Further ES2015 RegExp spec compliance fixes (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix cctest Created 4 years, 8 months 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
« no previous file with comments | « src/js/regexp.js ('k') | test/mjsunit/es6/classes-subclass-builtins.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 1931 matching lines...) Expand 10 before | Expand all | Expand 10 after
1942 "}" 1942 "}"
1943 "exception"); 1943 "exception");
1944 CHECK_EQ(1, use_counts[v8::Isolate::kRegExpPrototypeStickyGetter]); 1944 CHECK_EQ(1, use_counts[v8::Isolate::kRegExpPrototypeStickyGetter]);
1945 CHECK_EQ(0, use_counts[v8::Isolate::kRegExpPrototypeToString]); 1945 CHECK_EQ(0, use_counts[v8::Isolate::kRegExpPrototypeToString]);
1946 CHECK(resultStickyError->IsObject()); 1946 CHECK(resultStickyError->IsObject());
1947 1947
1948 // RegExp.prototype.toString() returns '/(?:)/' as a compatibility fix; 1948 // RegExp.prototype.toString() returns '/(?:)/' as a compatibility fix;
1949 // a UseCounter is incremented to track it. 1949 // a UseCounter is incremented to track it.
1950 v8::Local<v8::Value> resultToString = 1950 v8::Local<v8::Value> resultToString =
1951 CompileRun("RegExp.prototype.toString().length"); 1951 CompileRun("RegExp.prototype.toString().length");
1952 CHECK_EQ(1, use_counts[v8::Isolate::kRegExpPrototypeStickyGetter]); 1952 CHECK_EQ(2, use_counts[v8::Isolate::kRegExpPrototypeStickyGetter]);
1953 CHECK_EQ(1, use_counts[v8::Isolate::kRegExpPrototypeToString]); 1953 CHECK_EQ(1, use_counts[v8::Isolate::kRegExpPrototypeToString]);
1954 CHECK(resultToString->IsInt32()); 1954 CHECK(resultToString->IsInt32());
1955 CHECK_EQ(6, 1955 CHECK_EQ(6,
1956 resultToString->Int32Value(isolate->GetCurrentContext()).FromJust()); 1956 resultToString->Int32Value(isolate->GetCurrentContext()).FromJust());
1957 1957
1958 // .toString() works on normal RegExps 1958 // .toString() works on normal RegExps
1959 v8::Local<v8::Value> resultReToString = CompileRun("/a/.toString().length"); 1959 v8::Local<v8::Value> resultReToString = CompileRun("/a/.toString().length");
1960 CHECK_EQ(1, use_counts[v8::Isolate::kRegExpPrototypeStickyGetter]); 1960 CHECK_EQ(2, use_counts[v8::Isolate::kRegExpPrototypeStickyGetter]);
1961 CHECK_EQ(1, use_counts[v8::Isolate::kRegExpPrototypeToString]); 1961 CHECK_EQ(1, use_counts[v8::Isolate::kRegExpPrototypeToString]);
1962 CHECK(resultReToString->IsInt32()); 1962 CHECK(resultReToString->IsInt32());
1963 CHECK_EQ( 1963 CHECK_EQ(
1964 3, resultReToString->Int32Value(isolate->GetCurrentContext()).FromJust()); 1964 3, resultReToString->Int32Value(isolate->GetCurrentContext()).FromJust());
1965 1965
1966 // .toString() throws on non-RegExps that aren't RegExp.prototype 1966 // .toString() throws on non-RegExps that aren't RegExp.prototype
1967 v8::Local<v8::Value> resultToStringError = CompileRun( 1967 v8::Local<v8::Value> resultToStringError = CompileRun(
1968 "var exception;" 1968 "var exception;"
1969 "try { RegExp.prototype.toString.call(null) }" 1969 "try { RegExp.prototype.toString.call(null) }"
1970 "catch (e) { exception = e; }" 1970 "catch (e) { exception = e; }"
1971 "exception"); 1971 "exception");
1972 CHECK_EQ(1, use_counts[v8::Isolate::kRegExpPrototypeStickyGetter]); 1972 CHECK_EQ(2, use_counts[v8::Isolate::kRegExpPrototypeStickyGetter]);
1973 CHECK_EQ(1, use_counts[v8::Isolate::kRegExpPrototypeToString]); 1973 CHECK_EQ(1, use_counts[v8::Isolate::kRegExpPrototypeToString]);
1974 CHECK(resultToStringError->IsObject()); 1974 CHECK(resultToStringError->IsObject());
1975 } 1975 }
OLDNEW
« no previous file with comments | « src/js/regexp.js ('k') | test/mjsunit/es6/classes-subclass-builtins.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698