Skip to content

Commit

Permalink
chore: self mutation (e2e-1of2.diff)
Browse files Browse the repository at this point in the history
Signed-off-by: monada-bot[bot] <[email protected]>
  • Loading branch information
monadabot committed Aug 6, 2024
1 parent 32eb25a commit c9a795e
Show file tree
Hide file tree
Showing 2 changed files with 273 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,260 @@
# [std_type_annotation.test.w](../../../../../examples/tests/valid/std_type_annotation.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({ }) {
class $Closure1 {
constructor($args) {
const { } = $args;
const $obj = (...args) => this.handle(...args);
Object.setPrototypeOf($obj, this);
return $obj;
}
async handle(x, y) {
return (y.timestampMs >= x.timestampMs);
}
}
return $Closure1;
}
//# sourceMappingURL=inflight.$Closure1-1.cjs.map
```

## inflight.$Closure2-1.cjs
```cjs
"use strict";
const $helpers = require("@winglang/sdk/lib/helpers");
const $macros = require("@winglang/sdk/lib/macros");
module.exports = function({ $expect_Util, $isOlderOrEqual, $now, $std_Datetime, $then }) {
class $Closure2 {
constructor($args) {
const { } = $args;
const $obj = (...args) => this.handle(...args);
Object.setPrototypeOf($obj, this);
return $obj;
}
async handle() {
const later = (await $std_Datetime.fromComponents(({"day": $now.dayOfMonth, "hour": $now.hours, "year": ($now.year + 1), "min": $now.min, "month": $now.month, "ms": $now.ms, "sec": $now.sec, "tz": $now.timezone})));
(await $expect_Util.ok((await $isOlderOrEqual($then, $now))));
(await $expect_Util.ok((await $isOlderOrEqual($now, later))));
}
}
return $Closure2;
}
//# sourceMappingURL=inflight.$Closure2-1.cjs.map
```

## inflight.$Closure3-1.cjs
```cjs
"use strict";
const $helpers = require("@winglang/sdk/lib/helpers");
const $macros = require("@winglang/sdk/lib/macros");
module.exports = function({ }) {
class $Closure3 {
constructor($args) {
const { } = $args;
const $obj = (...args) => this.handle(...args);
Object.setPrototypeOf($obj, this);
return $obj;
}
async handle(re, s) {
return (await re.test(s));
}
}
return $Closure3;
}
//# sourceMappingURL=inflight.$Closure3-1.cjs.map
```

## inflight.$Closure4-1.cjs
```cjs
"use strict";
const $helpers = require("@winglang/sdk/lib/helpers");
const $macros = require("@winglang/sdk/lib/macros");
module.exports = function({ $decimal, $expect_Util, $std_Regex, $testString }) {
class $Closure4 {
constructor($args) {
const { } = $args;
const $obj = (...args) => this.handle(...args);
Object.setPrototypeOf($obj, this);
return $obj;
}
async handle() {
const binary = (await $std_Regex.compile("^[0-1]*$"));
(await $expect_Util.equal((await $testString($decimal, "24")), true));
(await $expect_Util.equal((await $testString($decimal, "340523")), true));
(await $expect_Util.equal((await $testString($decimal, "a23")), false));
(await $expect_Util.equal((await $testString(binary, "01101")), true));
(await $expect_Util.equal((await $testString(binary, "0")), true));
(await $expect_Util.equal((await $testString(binary, "120010")), false));
}
}
return $Closure4;
}
//# sourceMappingURL=inflight.$Closure4-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 $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")({
})
`;
}
get _liftMap() {
return ({
"handle": [
],
"$inflight_init": [
],
});
}
}
class $Closure2 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.$Closure2-1.cjs")({
$expect_Util: ${$stdlib.core.liftObject($stdlib.core.toLiftableModuleType(globalThis.$ClassFactory.resolveType("@winglang/sdk.expect.Util") ?? expect.Util, "@winglang/sdk/expect", "Util"))},
$isOlderOrEqual: ${$stdlib.core.liftObject(isOlderOrEqual)},
$now: ${$stdlib.core.liftObject(now)},
$std_Datetime: ${$stdlib.core.liftObject($stdlib.core.toLiftableModuleType(globalThis.$ClassFactory.resolveType("@winglang/sdk.std.Datetime") ?? std.Datetime, "@winglang/sdk/std", "Datetime"))},
$then: ${$stdlib.core.liftObject(then)},
})
`;
}
get _liftMap() {
return ({
"handle": [
[$stdlib.core.toLiftableModuleType(globalThis.$ClassFactory.resolveType("@winglang/sdk.expect.Util") ?? expect.Util, "@winglang/sdk/expect", "Util"), ["ok"]],
[$stdlib.core.toLiftableModuleType(globalThis.$ClassFactory.resolveType("@winglang/sdk.std.Datetime") ?? std.Datetime, "@winglang/sdk/std", "Datetime"), ["fromComponents"]],
[isOlderOrEqual, ["handle"]],
[now, [].concat(["dayOfMonth"], ["hours"], ["year"], ["min"], ["month"], ["ms"], ["sec"], ["timezone"])],
[then, []],
],
"$inflight_init": [
[$stdlib.core.toLiftableModuleType(globalThis.$ClassFactory.resolveType("@winglang/sdk.expect.Util") ?? expect.Util, "@winglang/sdk/expect", "Util"), []],
[$stdlib.core.toLiftableModuleType(globalThis.$ClassFactory.resolveType("@winglang/sdk.std.Datetime") ?? std.Datetime, "@winglang/sdk/std", "Datetime"), []],
[isOlderOrEqual, []],
[now, []],
[then, []],
],
});
}
}
class $Closure3 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.$Closure3-1.cjs")({
})
`;
}
get _liftMap() {
return ({
"handle": [
],
"$inflight_init": [
],
});
}
}
class $Closure4 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.$Closure4-1.cjs")({
$decimal: ${$stdlib.core.liftObject(decimal)},
$expect_Util: ${$stdlib.core.liftObject($stdlib.core.toLiftableModuleType(globalThis.$ClassFactory.resolveType("@winglang/sdk.expect.Util") ?? expect.Util, "@winglang/sdk/expect", "Util"))},
$std_Regex: ${$stdlib.core.liftObject($stdlib.core.toLiftableModuleType(globalThis.$ClassFactory.resolveType("@winglang/sdk.std.Regex") ?? std.Regex, "@winglang/sdk/std", "Regex"))},
$testString: ${$stdlib.core.liftObject(testString)},
})
`;
}
get _liftMap() {
return ({
"handle": [
[$stdlib.core.toLiftableModuleType(globalThis.$ClassFactory.resolveType("@winglang/sdk.expect.Util") ?? expect.Util, "@winglang/sdk/expect", "Util"), ["equal"]],
[$stdlib.core.toLiftableModuleType(globalThis.$ClassFactory.resolveType("@winglang/sdk.std.Regex") ?? std.Regex, "@winglang/sdk/std", "Regex"), ["compile"]],
[decimal, []],
[testString, ["handle"]],
],
"$inflight_init": [
[$stdlib.core.toLiftableModuleType(globalThis.$ClassFactory.resolveType("@winglang/sdk.expect.Util") ?? expect.Util, "@winglang/sdk/expect", "Util"), []],
[$stdlib.core.toLiftableModuleType(globalThis.$ClassFactory.resolveType("@winglang/sdk.std.Regex") ?? std.Regex, "@winglang/sdk/std", "Regex"), []],
[decimal, []],
[testString, []],
],
});
}
}
const then = (std.Datetime.utcNow());
const now = then;
const isOlderOrEqual = new $Closure1(this, "$Closure1");
globalThis.$ClassFactory.new("@winglang/sdk.std.Test", std.Test, this, "test:datetime is a valid type", new $Closure2(this, "$Closure2"));
const decimal = (std.Regex.compile("^[0-9]*$"));
const testString = new $Closure3(this, "$Closure3");
globalThis.$ClassFactory.new("@winglang/sdk.std.Test", std.Test, this, "test:regex is valid type", new $Closure4(this, "$Closure4"));
}
}
const $APP = $PlatformManager.createApp({ outdir: $outdir, name: "std_type_annotation.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
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# [std_type_annotation.test.w](../../../../../examples/tests/valid/std_type_annotation.test.w) | test | sim

## stdout.log
```log
pass ─ std_type_annotation.test.wsim » root/Default/test:datetime is a valid type
pass ─ std_type_annotation.test.wsim » root/Default/test:regex is valid type
Tests 2 passed (2)
Snapshots 1 skipped
Test Files 1 passed (1)
Duration <DURATION>
```

0 comments on commit c9a795e

Please sign in to comment.