Skip to content
This repository has been archived by the owner on Mar 26, 2024. It is now read-only.

Commit

Permalink
added if else testing
Browse files Browse the repository at this point in the history
  • Loading branch information
eoussama committed Mar 21, 2024
1 parent 7ae7a87 commit 816622d
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 13 deletions.
14 changes: 1 addition & 13 deletions langkama/ai.nkm
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,4 @@ big if true (show) {
loncina("result: " + bait(z));
} sike {
loncina("calculated!");
}

let me cook test() {
big if true (W) {
reda 1;
} sike {
reda 2;
}

loncina("should NOT execute");
}

bs reda test(); Script output should be 1
}
25 changes: 25 additions & 0 deletions test/conditions.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,31 @@ describe('Conditions', () => {
})
.interpret(code);
});

test('If else statement 3', done => {
const code = `
a sa7 hear me out age is 21;
a sa7 hear me out entryAge is 18;
hear me out value is L;
big if true (age = entryAge) {
value is 50;
} jk (age > entryAge) {
value is 100;
} sike {
value is 0;
}
reda value;
`;

compiler
.on(LangKamaEvent.Success, result => {
expect(result.value).toBe(100);
done();
})
.interpret(code);
});
});

describe('Condition errors', () => {
Expand Down

0 comments on commit 816622d

Please sign in to comment.