JS: Add test for private fields

This commit is contained in:
Asger F
2024-02-14 14:03:32 +01:00
parent 2a91bb8c54
commit 5c454944a9
3 changed files with 53 additions and 0 deletions

View File

@@ -1,4 +1,8 @@
testFailures
| pack11/index.ts:2:12:2:65 | // $ me ... .name.m | Missing result:method=(pack11).C1.publicField.really.long.name.m |
| pack11/index.ts:33:1:33:16 | | Unexpected result: method=(pack11).C3.privateField |
| pack11/index.ts:33:18:33:69 | // $ me ... ng.name | Missing result:method=(pack11).C3.publicField.really.long.name |
| pack11/index.ts:41:23:41:24 | | Unexpected result: alias=(pack11).C3.publicField.really.long.name==(pack11).C3.privateField |
ambiguousPreferredPredecessor
| pack2/lib.js:8:22:8:34 | def moduleImport("pack2").getMember("exports").getMember("lib").getMember("LibClass").getMember("foo") |
ambiguousSinkName

View File

@@ -0,0 +1,45 @@
const f1 = {
m() {} // $ method=(pack11).C1.publicField.really.long.name.m
};
export class C1 {
private static privateField = f1;
public static publicField = {
really: {
long: {
name: f1
}
}
}
} // $ class=(pack11).C1 instance=(pack11).C1.prototype
const f2 = {
m() {} // $ method=(pack11).C2.publicField.really.long.name.m
}
export class C2 {
static #privateField = f2;
static publicField = {
really: {
long: {
name: f2
}
}
}
} // $ class=(pack11).C2 instance=(pack11).C2.prototype
function f3() {} // $ method=(pack11).C3.publicField.really.long.name
export class C3 {
private static privateField = f3;
public static publicField = {
really: {
long: {
name: f3
}
}
}
} // $ class=(pack11).C3 instance=(pack11).C3.prototype

View File

@@ -0,0 +1,4 @@
{
"name": "pack11",
"main": "./index.js"
}