uqbar-project / wollok-ts

TypeScript based Wollok language implementation
GNU General Public License v3.0
19 stars 16 forks source link

Wollok Tests run failed assert does not point to the specific assert but the general test starting line. #302

Open isaiaslafon opened 4 weeks ago

isaiaslafon commented 4 weeks ago

Wollok Tests run failed assert does not point to the specific assert but the general test starting line. In Xtext version show the specific assert line that fail. If you use more than one assert it become tedious to found the failing one.

image

fdodino commented 2 weeks ago

hay que armar una épica junto con el tema de distinguir error/failure/ok

fdodino commented 1 week ago

uf, esto pasa también si lo ejecutamos dentro de un método.

image

fdodino commented 1 week ago

Cosas que vi: probé cambiar la lógica de execBody

  protected *execBody(node: Body): Execution<RuntimeValue> {
    yield node

    let result: RuntimeValue
    for (const sentence of node.sentences) {
      const frame = node.parent.is(Test) ? new Frame(sentence) : undefined
      result = yield* this.exec(sentence, frame)
      if (frame) this.frameStack.pop()
    }

    return isVoid(result) ? yield* this.reifyVoid() : result
  }

de esta manera se genera un frame, buenísimo, pero me muestra

  1) Wollok Interpreter
       interpret API function
         should handle void values for assert:
     wollok.lang.EvaluationError: Error: Could not resolve reference to assert
        at equals/2 [REPL:7]
        at REPL."mmm energy" [REPL:6]
     Derived from TypeScript stack

o sea, no tenemos el código posta para decir se rompió haciendo assert.equals(110, pajarito.energy()).

Y por otra parte no puedo agregar a los métodos dentro de esta pregunta

      const frame = node.parent.is(Test) || node.parent.is(Method) ? new Frame(sentence) : undefined

porque me tira

 wollok.lang.EvaluationError: TypeError: Cannot read properties of undefined (reading 'module')
  Could not retrieve Wollok stack due to error: wollok.lang.EvaluationError: Error: Could not resolve reference to printer
  Could not retrieve Wollok stack due to error: TypeError: Cannot read properties of undefined (reading 'node')
      at get environment [as environment] (src/interpreter/runtimeModel.ts:251:47)
      at Evaluation.error (src/interpreter/runtimeModel.ts:642:63)
      at error.next (<anonymous>)
      at Evaluation.exec (src/interpreter/runtimeModel.ts:361:77)
      at exec.next (<anonymous>)
      at Evaluation.invoke (src/interpreter/runtimeModel.ts:579:28)
      at invoke.next (<anonymous>)
      at Evaluation.send (src/interpreter/runtimeModel.ts:575:28)
      at send.next (<anonymous>)
      at Evaluation.<anonymous> (src/interpreter/interpreter.ts:54:58)
      at Generator.next (<anonymous>)
      at Interpreter.do (src/interpreter/interpreter.ts:105:30)
      at Interpreter.send (src/interpreter/interpreter.ts:54:23)
      at get wollokStack [as wollokStack] (src/interpreter/runtimeModel.ts:29:78)

está duro porque me parece que hay que repensar el modelo de frames que tiene el intérprete o bien cómo tiramos error.