Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Malformed sentence validations #161

Merged
merged 1 commit into from
Jul 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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