Skip to content

Commit

Permalink
Merge pull request #1389 from onflow/chasefleming/format-access-mods
Browse files Browse the repository at this point in the history
Format boilerplat access modifiers
  • Loading branch information
chasefleming authored Feb 7, 2024
2 parents b05ee6f + d6116c1 commit 49d80e4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
6 changes: 4 additions & 2 deletions internal/super/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,11 +157,13 @@ func generateNew(
switch templateType {
case "contract":
fileToWrite = fmt.Sprintf(`
access(all) contract %s {
access(all)
contract %s {
init() {}
}`, name)
case "script":
fileToWrite = `access(all) fun main() {
fileToWrite = `access(all)
fun main() {
// Script details here
}`
case "transaction":
Expand Down
9 changes: 6 additions & 3 deletions internal/super/generate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ func TestGenerateNewContract(t *testing.T) {

// Check content is correct
expectedContent := `
access(all) contract TestContract {
access(all)
contract TestContract {
init() {}
}`
assert.Equal(t, expectedContent, string(fileContent))
Expand Down Expand Up @@ -129,7 +130,8 @@ func TestGenerateNewScript(t *testing.T) {
assert.NoError(t, err, "Failed to read generated file")
assert.NotNil(t, content)

expectedContent := `access(all) fun main() {
expectedContent := `access(all)
fun main() {
// Script details here
}`
assert.Equal(t, expectedContent, string(content))
Expand Down Expand Up @@ -185,7 +187,8 @@ func TestGenerateNewWithDirFlag(t *testing.T) {
assert.NotNil(t, content)

expectedContent := `
access(all) contract TestContract {
access(all)
contract TestContract {
init() {}
}`
assert.Equal(t, expectedContent, string(content))
Expand Down

0 comments on commit 49d80e4

Please sign in to comment.