-
Notifications
You must be signed in to change notification settings - Fork 200
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: self mutation (e2e-1of2.diff)
Signed-off-by: monada-bot[bot] <[email protected]>
- Loading branch information
Showing
3 changed files
with
190 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
175 changes: 175 additions & 0 deletions
175
...r/__snapshots__/test_corpus/valid/super_inflight_class.test.w_compile_tf-aws.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,175 @@ | ||
# [super_inflight_class.test.w](../../../../../examples/tests/valid/super_inflight_class.test.w) | compile | tf-aws | ||
|
||
## inflight.$Closure1-1.cjs | ||
```cjs | ||
"use strict"; | ||
const $helpers = require("@winglang/sdk/lib/helpers"); | ||
const $macros = require("@winglang/sdk/lib/macros"); | ||
module.exports = function({ $c, $expect_Util }) { | ||
class $Closure1 { | ||
constructor($args) { | ||
const { } = $args; | ||
const $obj = (...args) => this.handle(...args); | ||
Object.setPrototypeOf($obj, this); | ||
return $obj; | ||
} | ||
async handle() { | ||
(await $expect_Util.equal((await $c.add(2, 3)), 5)); | ||
(await $expect_Util.equal($c.x, 3)); | ||
} | ||
} | ||
return $Closure1; | ||
} | ||
//# sourceMappingURL=inflight.$Closure1-1.cjs.map | ||
``` | ||
|
||
## inflight.BaseClass-1.cjs | ||
```cjs | ||
"use strict"; | ||
const $helpers = require("@winglang/sdk/lib/helpers"); | ||
const $macros = require("@winglang/sdk/lib/macros"); | ||
module.exports = function({ }) { | ||
class BaseClass { | ||
async add(a, b) { | ||
return (a + b); | ||
} | ||
async $inflight_init() { | ||
console.log("BaseClass.inflight new"); | ||
this.x = 2; | ||
} | ||
} | ||
return BaseClass; | ||
} | ||
//# sourceMappingURL=inflight.BaseClass-1.cjs.map | ||
``` | ||
|
||
## inflight.SuperClass-1.cjs | ||
```cjs | ||
"use strict"; | ||
const $helpers = require("@winglang/sdk/lib/helpers"); | ||
const $macros = require("@winglang/sdk/lib/macros"); | ||
module.exports = function({ $BaseClass }) { | ||
class SuperClass extends $BaseClass { | ||
async $inflight_init() { | ||
await super.$inflight_init?.(); | ||
this.x += 1; | ||
console.log("SuperClass.inflight new"); | ||
} | ||
} | ||
return SuperClass; | ||
} | ||
//# sourceMappingURL=inflight.SuperClass-1.cjs.map | ||
``` | ||
## main.tf.json | ||
```json | ||
{ | ||
"//": { | ||
"metadata": { | ||
"backend": "local", | ||
"stackName": "root" | ||
}, | ||
"outputs": {} | ||
}, | ||
"provider": { | ||
"aws": [ | ||
{} | ||
] | ||
} | ||
} | ||
``` | ||
## preflight.cjs | ||
```cjs | ||
"use strict"; | ||
const $stdlib = require('@winglang/sdk'); | ||
const $macros = require("@winglang/sdk/lib/macros"); | ||
const $platforms = ((s) => !s ? [] : s.split(';'))(process.env.WING_PLATFORMS); | ||
const $outdir = process.env.WING_SYNTH_DIR ?? "."; | ||
const $wing_is_test = process.env.WING_IS_TEST === "true"; | ||
const std = $stdlib.std; | ||
const $helpers = $stdlib.helpers; | ||
const $extern = $helpers.createExternRequire(__dirname); | ||
const $PlatformManager = new $stdlib.platform.PlatformManager({platformPaths: $platforms}); | ||
class $Root extends $stdlib.std.Resource { | ||
constructor($scope, $id) { | ||
super($scope, $id); | ||
$helpers.nodeof(this).root.$preflightTypesMap = { }; | ||
let $preflightTypesMap = {}; | ||
const expect = $stdlib.expect; | ||
$helpers.nodeof(this).root.$preflightTypesMap = $preflightTypesMap; | ||
class BaseClass extends $stdlib.std.Resource { | ||
constructor($scope, $id, ) { | ||
super($scope, $id); | ||
} | ||
static _toInflightType() { | ||
return ` | ||
require("${$helpers.normalPath(__dirname)}/inflight.BaseClass-1.cjs")({ | ||
}) | ||
`; | ||
} | ||
get _liftMap() { | ||
return ({ | ||
"add": [ | ||
], | ||
"$inflight_init": [ | ||
], | ||
"x": [ | ||
], | ||
}); | ||
} | ||
} | ||
class SuperClass extends BaseClass { | ||
constructor($scope, $id, ) { | ||
super($scope, $id); | ||
} | ||
static _toInflightType() { | ||
return ` | ||
require("${$helpers.normalPath(__dirname)}/inflight.SuperClass-1.cjs")({ | ||
$BaseClass: ${$stdlib.core.liftObject(BaseClass)}, | ||
}) | ||
`; | ||
} | ||
get _liftMap() { | ||
return $stdlib.core.mergeLiftDeps(super._liftMap, { | ||
"$inflight_init": [ | ||
], | ||
}); | ||
} | ||
} | ||
class $Closure1 extends $stdlib.std.AutoIdResource { | ||
_id = $stdlib.core.closureId(); | ||
constructor($scope, $id, ) { | ||
super($scope, $id); | ||
$helpers.nodeof(this).hidden = true; | ||
} | ||
static _toInflightType() { | ||
return ` | ||
require("${$helpers.normalPath(__dirname)}/inflight.$Closure1-1.cjs")({ | ||
$c: ${$stdlib.core.liftObject(c)}, | ||
$expect_Util: ${$stdlib.core.liftObject($stdlib.core.toLiftableModuleType(globalThis.$ClassFactory.resolveType("@winglang/sdk.expect.Util") ?? expect.Util, "@winglang/sdk/expect", "Util"))}, | ||
}) | ||
`; | ||
} | ||
get _liftMap() { | ||
return ({ | ||
"handle": [ | ||
[$stdlib.core.toLiftableModuleType(globalThis.$ClassFactory.resolveType("@winglang/sdk.expect.Util") ?? expect.Util, "@winglang/sdk/expect", "Util"), ["equal"]], | ||
[c, [].concat(["add"], ["x"])], | ||
], | ||
"$inflight_init": [ | ||
[$stdlib.core.toLiftableModuleType(globalThis.$ClassFactory.resolveType("@winglang/sdk.expect.Util") ?? expect.Util, "@winglang/sdk/expect", "Util"), []], | ||
[c, []], | ||
], | ||
}); | ||
} | ||
} | ||
const c = new SuperClass(this, "SuperClass"); | ||
globalThis.$ClassFactory.new("@winglang/sdk.std.Test", std.Test, this, "test:counter works", new $Closure1(this, "$Closure1")); | ||
} | ||
} | ||
const $APP = $PlatformManager.createApp({ outdir: $outdir, name: "super_inflight_class.test", rootConstruct: $Root, isTestEnvironment: $wing_is_test, entrypointDir: process.env['WING_SOURCE_DIR'], rootId: process.env['WING_ROOT_ID'] }); | ||
$APP.synth(); | ||
//# sourceMappingURL=preflight.cjs.map | ||
``` | ||
14 changes: 14 additions & 0 deletions
14
.../hangar/__snapshots__/test_corpus/valid/super_inflight_class.test.w_test_sim.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# [super_inflight_class.test.w](../../../../../examples/tests/valid/super_inflight_class.test.w) | test | sim | ||
|
||
## stdout.log | ||
```log | ||
[INFO] counter works | BaseClass.inflight new | ||
[INFO] counter works | SuperClass.inflight new | ||
pass ─ super_inflight_class.test.wsim » root/Default/test:counter works | ||
Tests 1 passed (1) | ||
Snapshots 1 skipped | ||
Test Files 1 passed (1) | ||
Duration <DURATION> | ||
``` | ||
|