Jelajahi Sumber

Changed spec.js output format

Michael Ferris 9 tahun lalu
induk
melakukan
d373ec7aff
2 mengubah file dengan 17 tambahan dan 13 penghapusan
  1. 4 4
      test/WasmSpec/baselines/linking.baseline
  2. 13 9
      test/WasmSpec/spec.js

+ 4 - 4
test/WasmSpec/baselines/linking.baseline

@@ -1,5 +1,5 @@
-(66) linking.wast:180: assert_trap call(i32:7) failed. Should have had an error
-(68) linking.wast:192: assert_trap call(i32:7) failed. Should have had an error
-(92) linking.wast:273: assert_return load(i32:0) == i32:0 failed. Returned 97
-(94) linking.wast:285: assert_return load(i32:0) == i32:0 failed. Returned 97
+(66) linking.wast:180: assert_trap($Mt.call(i32:7)) failed. Should have had an error
+(68) linking.wast:192: assert_trap($Mt.call(i32:7)) failed. Should have had an error
+(92) linking.wast:273: assert_return($Mm.load(i32:0) == i32:0) failed. Returned 97
+(94) linking.wast:285: assert_return($Mm.load(i32:0) == i32:0) failed. Returned 97
 85/89 tests passed.

+ 13 - 9
test/WasmSpec/spec.js

@@ -66,9 +66,10 @@ function getArgsStr(args) {
 }
 
 function getActionStr(action) {
+  const moduleName = action.module || "$$";
   switch (action.type) {
-    case "invoke": return `${action.field}(${getArgsStr(action.args)})`;
-    case "get": return `${action.module || "$$"}[${action.field}]`;
+    case "invoke": return `${moduleName}.${action.field}(${getArgsStr(action.args)})`;
+    case "get": return `${moduleName}[${action.field}]`;
     default: return "Unkown action type";
   }
 }
@@ -78,13 +79,16 @@ function getCommandStr(command) {
   switch (command.type) {
     case "module": return `${base}: generate module ${command.filename}${command.name ? ` as ${command.name}` : ""}`;
     case "register": return `${base}: register module ${command.name || "$$"} as ${command.as}`;
-    case "assert_malformed": return `${base}: assert_malformed module ${command.filename}`;
-    case "assert_unlinkable": return `${base}: assert_unlinkable module ${command.filename}`;
-    case "assert_invalid": return `${base}: assert_invalid module ${command.filename}`;
-    case "action": return `${base}: action ${getActionStr(command.action)}`;
-    case "assert_trap": return `${base}: assert_trap ${getActionStr(command.action)}`;
-    case "assert_return": return `${base}: assert_return ${getActionStr(command.action)} == ${getArgsStr(command.expected)}`;
-    case "assert_return_nan": return `${base}: assert_return_nan ${getActionStr(command.action)}`;
+    case "assert_malformed":
+    case "assert_unlinkable":
+    case "assert_uninstantiable":
+    case "assert_invalid": return `${base}: ${command.type} module ${command.filename}`;
+    case "assert_return": return `${base}: assert_return(${getActionStr(command.action)} == ${getArgsStr(command.expected)})`;
+    case "action":
+    case "assert_trap":
+    case "assert_return_nan":
+    case "assert_exhaustion":
+      return `${base}: ${command.type}(${getActionStr(command.action)})`;
   }
   return base;
 }