Skip to content

Commit

Permalink
test(evaluator): suporte plus operator in string
Browse files Browse the repository at this point in the history
  • Loading branch information
yazaldefilimone committed Aug 24, 2023
1 parent b3b216b commit e76b34d
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/evaluator/tests/string.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,23 @@ describe("Evaluator", () => {
expect(evaluated).toBeInstanceOf(BaseString);
expect(evaluated?.inspect()).toMatch("Hello World");
});
it("should suporte plus operator in string", () => {
const tests = [
{
input: `"Hello" + " " + "World"`,
expected: "Hello World",
},
{
input: `"Hello" + " " + "World" + "!"`,
expected: "Hello World!",
},
];
tests.forEach((tt) => {
const evaluated = makeSut(tt.input);
expect(evaluated).toBeDefined();
expect(evaluated).toBeInstanceOf(BaseString);
expect(evaluated?.inspect()).toMatch(tt.expected);
});
});
});
});

0 comments on commit e76b34d

Please sign in to comment.