Skip to content

Commit

Permalink
chore(go): adding new compliance tests (#2655)
Browse files Browse the repository at this point in the history
Additionally, correct code generation for variadic methods and
constructors, as previously the variadicity was simply ignored.

Partially implements #2634
  • Loading branch information
RomainMuller committed Mar 18, 2021
1 parent 87df2df commit a830834
Show file tree
Hide file tree
Showing 25 changed files with 1,338 additions and 569 deletions.
78 changes: 39 additions & 39 deletions gh-pages/content/specification/6-compliance-report.md

Large diffs are not rendered by default.

31 changes: 31 additions & 0 deletions packages/@jsii/go-runtime-test/build-tools/go-run.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { runCommand } from '@jsii/go-runtime/build-tools/_constants';
import { spawnSync } from 'child_process';
import { constants } from 'os';
import { join } from 'path';
import { argv, exit } from 'process';

if (argv.length < 3) {
console.error(`Not enough arguments: ${argv[0]} ${argv[1]} <cmd> [args]`);
exit(1);
}

const [, , cmd, ...args] = argv;

const result = spawnSync('go', ['env', 'GOPATH'], {
stdio: ['inherit', 'pipe', 'inherit'],
});

if (result.error) {
console.error('"go env GOPATH" failed:', result.error);
exit(-1);
}

if (result.status !== 0) {
console.error('"go env GOPATH" failed:', result.status ?? result.signal);
exit(
result.status ?? 128 + constants.signals[result.signal as NodeJS.Signals],
);
}

const gopath = result.stdout.toString('utf8').trim();
runCommand(join(gopath, 'bin', cmd), args);
10 changes: 5 additions & 5 deletions packages/@jsii/go-runtime-test/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@
"description": "",
"scripts": {
"build": "tsc --build && yarn gen:calc",
"fmt": "(cd project && go fmt ./...)",
"lint": "(cd project && go vet ./...)",
"test": "(cd project && go test ./...)",
"fmt": "yarn --silent go:run goimports -w .",
"lint": "cd project && go vet ./... && yarn --silent go:run golint ./...",
"test": "cd project && go test ./...",
"lint:fix": "yarn lint && yarn fmt",
"gen:calc": "node build-tools/gen-calc.js"
"gen:calc": "node build-tools/gen-calc.js",
"go:run": "cd project && go mod download && node ../build-tools/go-run.js"
},
"keywords": [],
"author": "",
Expand All @@ -21,5 +22,4 @@
"fs-extra": "^9.1.0",
"@jsii/go-runtime": "^0.0.0"
}

}
5 changes: 3 additions & 2 deletions packages/@jsii/go-runtime-test/project/compliance.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ package tests

import (
"encoding/json"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/suite"
"io/ioutil"
"strings"

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/suite"
)

type ComplianceSuite struct {
Expand Down

0 comments on commit a830834

Please sign in to comment.