Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable almost all tc39 tests #1816

Merged
merged 5 commits into from
Feb 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ require (
github.com/andybalholm/cascadia v1.0.0 // indirect
github.com/daaku/go.zipexe v0.0.0-20150329023125-a5fe2436ffcb // indirect
github.com/dlclark/regexp2 v1.4.1-0.20201116162257-a2a8dda75c91 // indirect
github.com/dop251/goja v0.0.0-20210111190058-952c20e23c35
github.com/dop251/goja v0.0.0-20210126164150-f5884268f0c0
github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4
github.com/eapache/go-resiliency v1.1.0 // indirect
github.com/eapache/go-xerial-snappy v0.0.0-20160609142408-bb955e01b934 // indirect
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/dlclark/regexp2 v1.4.1-0.20201116162257-a2a8dda75c91 h1:Izz0+t1Z5nI16/II7vuEo/nHjodOg0p7+OiDpjX5t1E=
github.com/dlclark/regexp2 v1.4.1-0.20201116162257-a2a8dda75c91/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55kozfMjCc=
github.com/dop251/goja v0.0.0-20210111190058-952c20e23c35 h1:Wk/lMSLwLOjur+6f48utCuxUylqbPkPN4BZHIoyiNIc=
github.com/dop251/goja v0.0.0-20210111190058-952c20e23c35/go.mod h1:Mw6PkjjMXWbTj+nnj4s3QPXq1jaT0s5pC0iFD4+BOAA=
github.com/dop251/goja v0.0.0-20210126164150-f5884268f0c0 h1:6zmaq2NhOm//MNgxDPXoLiWS1c/WTPxqqeUAQFrZRbQ=
github.com/dop251/goja v0.0.0-20210126164150-f5884268f0c0/go.mod h1:Mw6PkjjMXWbTj+nnj4s3QPXq1jaT0s5pC0iFD4+BOAA=
github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4 h1:qk/FSDDxo05wdJH28W+p5yivv7LuLYLRXPPD8KQCtZs=
github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk=
github.com/eapache/go-resiliency v1.1.0 h1:1NtRmCAqadE2FN4ZcN6g90TP3uk8cg9rn9eNK2197aU=
Expand Down
6,257 changes: 5,290 additions & 967 deletions js/tc39/breaking_test_errors.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/tc39/tc39_norace_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import "testing"

func (ctx *tc39TestCtx) runTest(name string, f func(t *testing.T)) {
ctx.t.Run(name, func(t *testing.T) {
// t.Parallel()
t.Parallel()
f(t)
})
}
Expand Down
139 changes: 68 additions & 71 deletions js/tc39/tc39_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,60 +44,69 @@ var (
});`,
false)

esIDPrefixAllowList = []string{
"sec-array",
"sec-%typedarray%",
"sec-string",
"sec-date",
"sec-number",
"sec-math",
"sec-arraybuffer-length",
"sec-arraybuffer",
"sec-regexp",
"sec-variable-statement",
"sec-ecmascript-standard-built-in-objects",
}

featuresBlockList = []string{
"BigInt", // not supported at all
"IsHTMLDDA", // not supported at all
}
skipList = map[string]bool{}
pathBasedBlock = map[string]bool{ // This completely skips any path matching it without any kind of message
"test/annexB/built-ins/Date": true,
"test/annexB/built-ins/RegExp/prototype/Symbol.split": true,
"test/annexB/built-ins/String/prototype/anchor": true,
"test/annexB/built-ins/String/prototype/big": true,
"test/annexB/built-ins/String/prototype/blink": true,
"test/annexB/built-ins/String/prototype/bold": true,
"test/annexB/built-ins/String/prototype/fixed": true,
"test/annexB/built-ins/String/prototype/fontcolor": true,
"test/annexB/built-ins/String/prototype/fontsize": true,
"test/annexB/built-ins/String/prototype/italics": true,
"test/annexB/built-ins/String/prototype/link": true,
"test/annexB/built-ins/String/prototype/small": true,
"test/annexB/built-ins/String/prototype/strike": true,
"test/annexB/built-ins/String/prototype/sub": true,
"test/annexB/built-ins/String/prototype/sup": true,

// Async/Promise and other totally unsupported functionality
"test/built-ins/AsyncArrowFunction": true,
"test/built-ins/AsyncFromSyncIteratorPrototype": true,
"test/built-ins/AsyncFunction": true,
"test/built-ins/AsyncGeneratorFunction": true,
"test/built-ins/AsyncGeneratorPrototype": true,
"test/built-ins/AsyncIteratorPrototype": true,
"test/built-ins/Atomics": true,
"test/built-ins/BigInt": true,
"test/built-ins/Promise": true,
"test/built-ins/SharedArrayBuffer": true,
"BigInt", // not supported at all
"IsHTMLDDA", // not supported at all
"generators", // not supported in a meaningful way IMO
"Array.prototype.item", // not even standard yet
"TypedArray.prototype.item", // not even standard yet
"String.prototype.replaceAll", // not supported at all, Stage 4 since 2020
}
skipList = map[string]bool{
"test/built-ins/Function/prototype/toString/AsyncFunction.js": true,
"test/built-ins/Object/seal/seal-generatorfunction.js": true,

"test/built-ins/Date/parse/without-utc-offset.js": true, // some other reason ?!? depending on local time

"test/built-ins/Array/prototype/concat/arg-length-exceeding-integer-limit.js": true, // takes forever and is broken
"test/built-ins/Array/prototype/splice/throws-if-integer-limit-exceeded.js": true, // takes forever and is broken
"test/built-ins/Array/prototype/unshift/clamps-to-integer-limit.js": true, // takes forever and is broken
"test/built-ins/Array/prototype/unshift/throws-if-integer-limit-exceeded.js": true, // takes forever and is broken

}
pathBasedBlock = []string{ // This completely skips any path matching it without any kind of message
"test/annexB/built-ins/Date",
"test/annexB/built-ins/RegExp/prototype/Symbol.split",
"test/annexB/built-ins/String/prototype/anchor",
"test/annexB/built-ins/String/prototype/big",
"test/annexB/built-ins/String/prototype/blink",
"test/annexB/built-ins/String/prototype/bold",
"test/annexB/built-ins/String/prototype/fixed",
"test/annexB/built-ins/String/prototype/fontcolor",
"test/annexB/built-ins/String/prototype/fontsize",
"test/annexB/built-ins/String/prototype/italics",
"test/annexB/built-ins/String/prototype/link",
"test/annexB/built-ins/String/prototype/small",
"test/annexB/built-ins/String/prototype/strike",
"test/annexB/built-ins/String/prototype/sub",
"test/annexB/built-ins/String/prototype/sup",

"test/annexB/built-ins/RegExp/legacy-accessors/",

// Async/Promise and other totally unsupported functionality
"test/built-ins/AsyncArrowFunction",
"test/built-ins/AsyncFromSyncIteratorPrototype",
"test/built-ins/AsyncFunction",
"test/built-ins/AsyncGeneratorFunction",
"test/built-ins/AsyncGeneratorPrototype",
"test/built-ins/AsyncIteratorPrototype",
"test/built-ins/Atomics",
"test/built-ins/BigInt",
"test/built-ins/Promise",
"test/built-ins/SharedArrayBuffer",
"test/built-ins/NativeErrors/AggregateError",
"test/language/eval-code/direct/async",
"test/language/expressions/async",
"test/language/expressions/dynamic-import",
"test/language/expressions/object/dstr/async",
"test/language/module-code/top-level-await",
"test/built-ins/Function/prototype/toString/async",
"test/built-ins/Function/prototype/toString/async",
"test/built-ins/Function/prototype/toString/generator",
"test/built-ins/Function/prototype/toString/proxy-async",

"test/built-ins/FinalizationRegistry", // still in proposal

}
)

Expand Down Expand Up @@ -227,7 +236,7 @@ func (ctx *tc39TestCtx) runTC39Test(t testing.TB, name, src string, meta *tc39Me
t.Skip("Excluded")
}
failf := func(str string, args ...interface{}) {
str = fmt.Sprintf(str, args)
str = fmt.Sprintf(str, args...)
ctx.fail(t, name, strict, str)
}
defer func() {
Expand Down Expand Up @@ -333,28 +342,13 @@ func shouldBeSkipped(t testing.TB, meta *tc39Meta) {
if meta.hasFlag("async") { // this is totally not supported
t.Skipf("Skipping as it has flag async")
}
if meta.Es6id == "" && meta.Es5id == "" { //nolint:nestif
skip := true

if skip {
if meta.Esid != "" {
for _, prefix := range esIDPrefixAllowList {
if strings.HasPrefix(meta.Esid, prefix) {
skip = false
}
}
}
}
for _, feature := range meta.Features {
for _, bl := range featuresBlockList {
if feature == bl {
t.Skipf("Blocklisted feature %s", feature)
}
for _, feature := range meta.Features {
for _, bl := range featuresBlockList {
if feature == bl {
t.Skipf("Blocklisted feature %s", feature)
}
}
if skip {
t.Skipf("Not ES6 or ES5 esid: %s", meta.Esid)
}
}
}

Expand Down Expand Up @@ -495,16 +489,19 @@ func (ctx *tc39TestCtx) runTC39Tests(name string) {
ctx.t.Fatal(err)
}

outer:
for _, file := range files {
if file.Name()[0] == '.' {
continue
}
newName := path.Join(name, file.Name())
if pathBasedBlock[newName] {
ctx.t.Run(newName, func(t *testing.T) {
t.Skipf("Skip %s beause of path based block", newName)
})
continue
for _, path := range pathBasedBlock { // TODO: use trie / binary search?
if strings.HasPrefix(newName, path) {
ctx.t.Run(newName, func(t *testing.T) {
t.Skipf("Skip %s beause of path based block", newName)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
t.Skipf("Skip %s beause of path based block", newName)
t.Skipf("Skipped %s because of path based block", newName)

})
continue outer
}
}
if file.IsDir() {
ctx.runTC39Tests(newName)
Expand Down
28 changes: 20 additions & 8 deletions vendor/github.com/dop251/goja/README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

42 changes: 16 additions & 26 deletions vendor/github.com/dop251/goja/array.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 3 additions & 10 deletions vendor/github.com/dop251/goja/array_sparse.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading