Skip to content

Commit

Permalink
added back commented tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Southclaws committed Mar 26, 2018
1 parent d417045 commit 3a47abf
Show file tree
Hide file tree
Showing 3 changed files with 146 additions and 138 deletions.
200 changes: 108 additions & 92 deletions rook/build_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,98 +26,98 @@ func TestPackage_Build(t *testing.T) {
wantProblems types.BuildProblems
wantErr bool
}{
// {
// "bare", []byte(`main(){}`), args{&types.Package{
// Parent: true,
// Local: util.FullPath("./tests/build-auto-bare"),
// DependencyMeta: versioning.DependencyMeta{User: "test", Repo: "bare"},
// Entry: "gamemodes/test.pwn",
// Output: "gamemodes/test.amx",
// Dependencies: []versioning.DependencyString{},
// Builds: []types.BuildConfig{
// {Name: "build", Version: "3.10.4"},
// },
// }, "build", true}, nil, false,
// },
// {
// "stdlib", []byte(`#include <a_samp>
// main() {print("hi");}`,
// ), args{&types.Package{
// Parent: true,
// Local: util.FullPath("./tests/build-auto-stdlib"),
// DependencyMeta: versioning.DependencyMeta{User: "test", Repo: "stdlib"},
// Entry: "gamemodes/test.pwn",
// Output: "gamemodes/test.amx",
// Dependencies: []versioning.DependencyString{
// "sampctl/samp-stdlib",
// },
// Builds: []types.BuildConfig{
// {Name: "build", Version: "3.10.4"},
// },
// }, "build", true}, nil, false,
// },
// {
// "deep", []byte(`#include <a_samp>
// #include <actions>
// main() { print("actions"); }`,
// ), args{&types.Package{
// Parent: true,
// Local: util.FullPath("./tests/build-auto-deep"),
// DependencyMeta: versioning.DependencyMeta{User: "test", Repo: "deep"},
// Entry: "gamemodes/test.pwn",
// Output: "gamemodes/test.amx",
// Dependencies: []versioning.DependencyString{
// "sampctl/samp-stdlib",
// "ScavengeSurvive/actions",
// },
// }, "build", true}, nil, false,
// },
// {
// "dev", []byte(`#include <a_samp>
// #include <actions>
// #include <test-boilerplate>
// main() { print("actions"); }`,
// ), args{&types.Package{
// Parent: true,
// Local: util.FullPath("./tests/build-auto-deep"),
// DependencyMeta: versioning.DependencyMeta{User: "test", Repo: "deep"},
// Entry: "gamemodes/test.pwn",
// Output: "gamemodes/test.amx",
// Dependencies: []versioning.DependencyString{
// "sampctl/samp-stdlib",
// "ScavengeSurvive/actions",
// },
// Development: []versioning.DependencyString{
// "ScavengeSurvive/test-boilerplate",
// },
// }, "build", true}, nil, false,
// },
// {
// "custominc", []byte(`#include <a_samp>
// #include <YSI\y_utils>
// main() {}`,
// ), args{&types.Package{
// Parent: true,
// Local: util.FullPath("./tests/build-auto-custominc"),
// DependencyMeta: versioning.DependencyMeta{User: "test", Repo: "custominc"},
// Entry: "gamemodes/test.pwn",
// Output: "gamemodes/test.amx",
// Dependencies: []versioning.DependencyString{
// "sampctl/samp-stdlib",
// },
// Builds: []types.BuildConfig{
// {
// Name: "build",
// Version: "3.10.4",
// Includes: []string{
// "../build-auto-deep/dependencies/amx_assembly",
// "../build-auto-deep/dependencies/YSI-Includes",
// },
// Args: []string{"-d3", "-;+", "-(+", "-\\+", "-Z+"},
// },
// },
// }, "build", true}, nil, false,
// },
{
"bare", []byte(`main(){}`), args{&types.Package{
Parent: true,
Local: util.FullPath("./tests/build-auto-bare"),
DependencyMeta: versioning.DependencyMeta{User: "test", Repo: "bare"},
Entry: "gamemodes/test.pwn",
Output: "gamemodes/test.amx",
Dependencies: []versioning.DependencyString{},
Builds: []types.BuildConfig{
{Name: "build", Version: "3.10.4"},
},
}, "build", true}, nil, false,
},
{
"stdlib", []byte(`#include <a_samp>
main() {print("hi");}`,
), args{&types.Package{
Parent: true,
Local: util.FullPath("./tests/build-auto-stdlib"),
DependencyMeta: versioning.DependencyMeta{User: "test", Repo: "stdlib"},
Entry: "gamemodes/test.pwn",
Output: "gamemodes/test.amx",
Dependencies: []versioning.DependencyString{
"sampctl/samp-stdlib",
},
Builds: []types.BuildConfig{
{Name: "build", Version: "3.10.4"},
},
}, "build", true}, nil, false,
},
{
"deep", []byte(`#include <a_samp>
#include <actions>
main() { print("actions"); }`,
), args{&types.Package{
Parent: true,
Local: util.FullPath("./tests/build-auto-deep"),
DependencyMeta: versioning.DependencyMeta{User: "test", Repo: "deep"},
Entry: "gamemodes/test.pwn",
Output: "gamemodes/test.amx",
Dependencies: []versioning.DependencyString{
"sampctl/samp-stdlib",
"ScavengeSurvive/actions",
},
}, "build", true}, nil, false,
},
{
"dev", []byte(`#include <a_samp>
#include <actions>
#include <test-boilerplate>
main() { print("actions"); }`,
), args{&types.Package{
Parent: true,
Local: util.FullPath("./tests/build-auto-deep"),
DependencyMeta: versioning.DependencyMeta{User: "test", Repo: "deep"},
Entry: "gamemodes/test.pwn",
Output: "gamemodes/test.amx",
Dependencies: []versioning.DependencyString{
"sampctl/samp-stdlib",
"ScavengeSurvive/actions",
},
Development: []versioning.DependencyString{
"ScavengeSurvive/test-boilerplate",
},
}, "build", true}, nil, false,
},
{
"custominc", []byte(`#include <a_samp>
#include <YSI\y_utils>
main() {}`,
), args{&types.Package{
Parent: true,
Local: util.FullPath("./tests/build-auto-custominc"),
DependencyMeta: versioning.DependencyMeta{User: "test", Repo: "custominc"},
Entry: "gamemodes/test.pwn",
Output: "gamemodes/test.amx",
Dependencies: []versioning.DependencyString{
"sampctl/samp-stdlib",
},
Builds: []types.BuildConfig{
{
Name: "build",
Version: "3.10.4",
Includes: []string{
"../build-auto-deep/dependencies/amx_assembly",
"../build-auto-deep/dependencies/YSI-Includes",
},
Args: []string{"-d3", "-;+", "-(+", "-\\+", "-Z+"},
},
},
}, "build", true}, nil, false,
},
{
"resourceinc", []byte(`#include <a_samp>
#include <a_mysql>
Expand All @@ -134,6 +134,22 @@ func TestPackage_Build(t *testing.T) {
},
}, "build", true}, nil, false,
},
{
"colandreasinc", []byte(`#include <a_samp>
#include <colandreas>
main() {}`,
), args{&types.Package{
Parent: true,
Local: util.FullPath("./tests/build-auto-colandreasinc"),
DependencyMeta: versioning.DependencyMeta{User: "test", Repo: "colandreasinc"},
Entry: "gamemodes/test.pwn",
Output: "gamemodes/test.amx",
Dependencies: []versioning.DependencyString{
"sampctl/samp-stdlib",
"Pottus/ColAndreas",
},
}, "build", true}, nil, false,
},
}
for _, tt := range tests {
err := os.MkdirAll(filepath.Join(tt.args.pkg.Local, "gamemodes"), 0755)
Expand Down
2 changes: 0 additions & 2 deletions rook/load.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package rook

import (
"fmt"
"os"
"path/filepath"

Expand Down Expand Up @@ -99,7 +98,6 @@ func ResolveDependencies(pkg *types.Package, platform string) (err error) {
if err != nil {
print.Warn(pkg, "Failed to resolve package resource paths:", err)
}
fmt.Println("GOT RESOURCES FOR", subPkg, ":", incPaths)
pkg.AllIncludePaths = append(pkg.AllIncludePaths, incPaths...)

// only add the package directory if there are no includes in the resources
Expand Down
82 changes: 38 additions & 44 deletions runtime/ensure_plugins_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,52 +24,46 @@ func TestEnsurePlugins(t *testing.T) {
wantPlugins []types.Plugin
wantErr bool
}{
// {"streamer-linux", args{
// types.Runtime{
// Platform: "linux",
// PluginDeps: []versioning.DependencyMeta{{User: "samp-incognito", Repo: "samp-streamer-plugin"}},
// }}, []string{"plugins/streamer.so"}, []types.Plugin{"streamer"}, false},
// {"streamer-windows", args{
// types.Runtime{
// Platform: "windows",
// PluginDeps: []versioning.DependencyMeta{{User: "samp-incognito", Repo: "samp-streamer-plugin"}},
// }}, []string{"plugins/streamer.dll"}, []types.Plugin{"streamer"}, false},
// {"mysql-linux", args{
// types.Runtime{
// Platform: "linux",
// PluginDeps: []versioning.DependencyMeta{{User: "pBlueG", Repo: "SA-MP-MySQL"}},
// }}, []string{"plugins/mysql.so"}, []types.Plugin{"mysql"}, false},
// {"mysql-windows", args{
// types.Runtime{
// Platform: "windows",
// PluginDeps: []versioning.DependencyMeta{{User: "pBlueG", Repo: "SA-MP-MySQL"}},
// }}, []string{"plugins/mysql.dll"}, []types.Plugin{"mysql"}, false},
// {"bitmapper-linux", args{
// types.Runtime{
// Platform: "linux",
// PluginDeps: []versioning.DependencyMeta{{User: "Southclaws", Repo: "samp-bitmapper"}},
// }}, []string{"plugins/bitmapper.so"}, []types.Plugin{"bitmapper"}, false},
// {"bitmapper-windows", args{
// types.Runtime{
// Platform: "windows",
// PluginDeps: []versioning.DependencyMeta{{User: "Southclaws", Repo: "samp-bitmapper"}},
// }}, []string{"plugins/bitmapper.dll"}, []types.Plugin{"bitmapper"}, false},
// {"PawnPlus-linux", args{
// types.Runtime{
// Platform: "linux",
// PluginDeps: []versioning.DependencyMeta{{User: "IllidanS4", Repo: "PawnPlus"}},
// }}, []string{"plugins/PawnPlus.so"}, []types.Plugin{"PawnPlus"}, false},
// {"PawnPlus-windows", args{
// types.Runtime{
// Platform: "windows",
// PluginDeps: []versioning.DependencyMeta{{User: "IllidanS4", Repo: "PawnPlus"}},
// }}, []string{"plugins/PawnPlus.dll"}, []types.Plugin{"PawnPlus"}, false},

{"discord-connector-linux", args{
{"streamer-linux", args{
types.Runtime{
Platform: "linux",
PluginDeps: []versioning.DependencyMeta{{User: "samp-incognito", Repo: "samp-streamer-plugin"}},
}}, []string{"plugins/streamer.so"}, []types.Plugin{"streamer"}, false},
{"streamer-windows", args{
types.Runtime{
Platform: "windows",
PluginDeps: []versioning.DependencyMeta{{User: "samp-incognito", Repo: "samp-streamer-plugin"}},
}}, []string{"plugins/streamer.dll"}, []types.Plugin{"streamer"}, false},
{"mysql-linux", args{
types.Runtime{
Platform: "linux",
PluginDeps: []versioning.DependencyMeta{{User: "maddinat0r", Repo: "samp-discord-connector"}},
}}, []string{"plugins/discord-connector.so"}, []types.Plugin{"discord-connector"}, false},
PluginDeps: []versioning.DependencyMeta{{User: "pBlueG", Repo: "SA-MP-MySQL"}},
}}, []string{"plugins/mysql.so"}, []types.Plugin{"mysql"}, false},
{"mysql-windows", args{
types.Runtime{
Platform: "windows",
PluginDeps: []versioning.DependencyMeta{{User: "pBlueG", Repo: "SA-MP-MySQL"}},
}}, []string{"plugins/mysql.dll"}, []types.Plugin{"mysql"}, false},
{"bitmapper-linux", args{
types.Runtime{
Platform: "linux",
PluginDeps: []versioning.DependencyMeta{{User: "Southclaws", Repo: "samp-bitmapper"}},
}}, []string{"plugins/bitmapper.so"}, []types.Plugin{"bitmapper"}, false},
{"bitmapper-windows", args{
types.Runtime{
Platform: "windows",
PluginDeps: []versioning.DependencyMeta{{User: "Southclaws", Repo: "samp-bitmapper"}},
}}, []string{"plugins/bitmapper.dll"}, []types.Plugin{"bitmapper"}, false},
{"PawnPlus-linux", args{
types.Runtime{
Platform: "linux",
PluginDeps: []versioning.DependencyMeta{{User: "IllidanS4", Repo: "PawnPlus"}},
}}, []string{"plugins/PawnPlus.so"}, []types.Plugin{"PawnPlus"}, false},
{"PawnPlus-windows", args{
types.Runtime{
Platform: "windows",
PluginDeps: []versioning.DependencyMeta{{User: "IllidanS4", Repo: "PawnPlus"}},
}}, []string{"plugins/PawnPlus.dll"}, []types.Plugin{"PawnPlus"}, false},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
Expand Down

0 comments on commit 3a47abf

Please sign in to comment.