Skip to content

Commit

Permalink
Merge pull request #161 from uqbar-project/body-as-expression-validat…
Browse files Browse the repository at this point in the history
…ions

Malformed sentence validations
  • Loading branch information
PalumboN authored Jul 30, 2023
2 parents edb2614 + b62c437 commit cca920e
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 5 deletions.
14 changes: 14 additions & 0 deletions test/validations/malformedSentence.wlk
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
@Expect(code="malformedMember", level="error")
object pepita {
const energy = 100

method wrongSyntax() = @Expect(code="malformedSentence", level="error")#2342amskdl;

method fly(kms) @Expect(code="malformedSentence", level="error") {
return energy = kms
}

// first 'energy' is correct and the next one is
// parsed as a "malformedMember"
method eat(food) = energy energy
}
4 changes: 2 additions & 2 deletions test/validations/missingReference.wlk
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ import @Expect(code="missingReference", level="error") inexistentFile.*

object pepita {

method energia() = @Expect(code="missingReference", level="error") energia
method energia() = (@Expect(code="missingReference", level="error") energia)

method comer(p) {
@Expect(code="missingReference", level="error", path="variable")
energia = 100
}

method estaCansada() = @Expect(code="missingReference", level="error") energia < 10
method estaCansada() = (@Expect(code="missingReference", level="error") energia < 10)

method methodName() {
self.comer(@Expect(code="missingReference", level="error") energia)
Expand Down
2 changes: 1 addition & 1 deletion test/validations/shouldNotUseVoidMethodAsValue.wlk
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class MethodsCalledOnWellKnowObjects inherits A {
return new B(a = @Expect(code = "shouldNotUseVoidMethodAsValue", message = "error") (pepita.ingest(10)))
}

method asExpressionOnMethodShortcut() = @Expect(code = "shouldNotUseVoidMethodAsValue", message = "error") (pepita.ingest(10))
method asExpressionOnMethodShortcut() = (@Expect(code = "shouldNotUseVoidMethodAsValue", message = "error") (pepita.ingest(10)))
}

class B {
Expand Down
4 changes: 2 additions & 2 deletions test/validations/shouldReturnAValueOnAllFlows.wlk
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,8 @@ object joaquin {
// =====================================================================================

method testValorDevueltoConMetodoGet() =
@Expect(code="shouldReturnAValueOnAllFlows", level="error")
if (tocaEnGrupo) 5
(@Expect(code="shouldReturnAValueOnAllFlows", level="error")
if (tocaEnGrupo) 5)

method validarFelicidad() {
assert.equals(10, @Expect(code="shouldReturnAValueOnAllFlows", level="error") if (tocaEnGrupo) 5)
Expand Down

0 comments on commit cca920e

Please sign in to comment.