0ad/binaries/data/mods/mod/hwdetect/test.js
Dunedan 93ce94655d
Use @stylistic/brace-style for eslint
Up to now `eslint-plugin-brace-rules` was used to enforce a common brace
style for JavaScript code. This plugin was however updated the last time
over 9 years ago and will be incompatible with ESLint v10, as that
[removes `context.getSourceCode()`][1], the plugin relies on.

To keep the eslint config working with ESLint v10, this replaces
`eslint-plugin-brace-rules` with the [`@stylistic/brace-style`][2] rule
from `@stylistic/eslint-plugin`, a package we already use.

While `@stylistic/brace-style` doesn't offer an option to format braces
in exactly the same way as before, the "allman" style seems to be the
one closest to the existing code.

[1]: https://eslint.org/blog/2025/11/eslint-v10.0.0-alpha.0-released/#removed-deprecated-rule-context-members
[2]: https://eslint.style/rules/brace-style
2026-01-12 21:33:52 +01:00

44 lines
1.4 KiB
JavaScript

// Run in a standalone JS shell like
// js -e 'var global={}' -f hwdetect.js -f test_data.js -f test.js > output.html
// where test_data.js is a giant file that's probably not publicly available yet
// (ask Philip if you want a copy), then look at output.html and make sure it's
// applying the hwdetected settings in the appropriate cases
print("<!DOCTYPE html>");
print("<meta charset=utf-8>");
print("<style>body { font: 8pt sans-serif; }</style>");
print("<table>");
print("<tr>");
print("<th>OS");
print("<th>GL_RENDERER");
print("<th>Output");
print("<th>Warnings");
hwdetectTestData.sort(function(a, b)
{
if (a.renderer_backend.GL_RENDERER < b.renderer_backend.GL_RENDERER)
return -1;
if (b.renderer_backend.GL_RENDERER < a.renderer_backend.GL_RENDERER)
return +1;
return 0;
});
for (var settings of hwdetectTestData)
{
var output = RunDetection(settings);
var os = (settings.os_linux ? "linux" : settings.os_macosx ? "macosx" : settings.os_win ? "win" : "???");
var disabled = [];
for (var d of ["disable_audio", "disable_s3tc", "disable_shadows", "disable_shadowpcf", "disable_allwater", "disable_fancywater", "override_renderpath"])
if (output[d] !== undefined)
disabled.push(d+"="+output[d]);
print("<tr>");
print("<td>" + os);
print("<td>" + settings.renderer_backend.GL_RENDERER);
print("<td>" + disabled.join(" "));
print("<td>" + output.warnings.concat(output.dialog_warnings).join("\n"));
}
print("</table>");