fix: wcsc 索引与 一个括号

处理一处索引出现负数的问题;
一处css输出了多余的括号。
This commit is contained in:
msojocs 2025-02-16 00:10:45 +08:00
parent 6797471f38
commit ee32f8dd93
10 changed files with 339 additions and 3 deletions

View File

@ -7,6 +7,7 @@ module.exports = {
// spec: "./test/spec/**/*.spec.ts",
spec: [
"./test/spec/**/*.spec.ts",
// 'test/spec/issue/129/issue129.spec.ts',
// 'test/spec/issue/115/issue115.spec.ts',
// 'test/spec/wcc/module/module.spec.ts',
],

12
.vscode/launch.json vendored
View File

@ -4,6 +4,18 @@
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "lldb",
"request": "launch",
"name": "Linux module test",
"program": "${workspaceFolder}/cache/nwjs-sdk-v0.55.0-linux-x64/nw",
"args": [
"${workspaceFolder}/test/runner/nwjs/compiler.js",
"wcsc",
"${workspaceFolder}/test/spec/issue/129/data/example.json"
],
"cwd": "${workspaceFolder}"
},
{
"name": "wcc wxs sample2",

View File

@ -86,5 +86,6 @@
"--background-index",
"--compile-commands-dir=${workspaceFolder}/build/"
],
"cmake.sourceDirectory": "/home/msojocs/github/wx-compiler"
"cmake.sourceDirectory": "/home/msojocs/github/wx-compiler",
"clangd.path": "clangd-18"
}

View File

@ -1,3 +1,10 @@
## 🌈 v0.1.2 / 2025-02-16
🐞 Bug Fixes
- `WXML::RPX::accept`: 数组出现负数的问题。
- `WXML::Rewrite::RewriteImg`: 输出了多余的右括号。
## 🌈 v0.1.1 / 2024-08-10
🐞 Bug Fixes

View File

@ -301,7 +301,7 @@ namespace WXML {
{
std::stringstream v29;
v29 << "url(" << sa << "-do-not-use-local-path-" << a3;
v29 << "&" << a4 << "&" << a5 << ")";
v29 << "&" << a4 << "&" << a5;
std::string v26 = v29.str();
a2 += v26;
result = 1;

View File

@ -33,7 +33,7 @@ namespace WXML
for (i = a3; i > 0; i--)
{
v7 = v4;
v4 = a1[266 * v4 + *a4]; // 266 * 4 = 0x428
v4 = a1[266 * v4 + (uint8_t)*a4]; // 266 * 4 = 0x428
if (v4 == -1)
{
break;

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,38 @@
import assert from "assert"
import path from "path"
import { describe } from "mocha";
import linux from '../../../runner/module-linux'
import windows from '../../../runner/module-windows'
import * as fs from 'fs'
describe("issue - 129", function () {
describe("issue: linux output should equal with wine", function () {
it("crash", async function () {
const p = path.resolve(__dirname, './data/example.json')
const storagePath = path.resolve(
__dirname,
`issue-129/${this.test?.title}`
);
try {
fs.mkdirSync(storagePath, { recursive: true });
} catch (error) {}
const w = await windows.wcsc(p);
const n = await linux.wcsc(p, '', storagePath);
// console.log('windows:', typeof w)
// console.log('linux:', typeof n)
fs.writeFileSync(
`${storagePath}/wine-output.json`,
JSON.stringify(w, null, 4)
);
fs.writeFileSync(
`${storagePath}/node-output.json`,
JSON.stringify(n, null, 4)
);
assert.equal(typeof n, typeof w);
assert.equal(w.success, true)
assert.deepEqual(n, w);
});
});
});

4
test/spec/issue/129/prepare.sh Executable file
View File

@ -0,0 +1,4 @@
#! /bin/bash
dir=$(cd `dirname $0` && pwd -P)

3
test/test-linux-module.sh Executable file
View File

@ -0,0 +1,3 @@
#!/bin/bash
/home/msojocs/github/wx-compiler/cache/nwjs-sdk-v0.55.0-linux-x64/nw /home/msojocs/github/wx-compiler/test/runner/nwjs/compiler.js wcsc /home/msojocs/github/wx-compiler/test/spec/issue/129/data/example.json