From 9f852d7353f7cdf5ebe6853fa17cc1059a68bee2 Mon Sep 17 00:00:00 2001 From: HJfod Date: Mon, 6 Jan 2025 13:31:41 +0200 Subject: [PATCH] pro updatpro updatee --- scripts/Test.swipe | 22 +++++++++++++++++---- swipe-vscode/syntaxes/swipe.tmLanguage.json | 2 +- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/scripts/Test.swipe b/scripts/Test.swipe index ceb7af25..fbe4fc75 100644 --- a/scripts/Test.swipe +++ b/scripts/Test.swipe @@ -1,11 +1,25 @@ -@version 1.0 +@swipe 8.2 @name "Swipe test" @by "HJfod" -function vararg(named, x, y, args...) { - // todo: why tf is this not just args[0], args[1]??? why is args not just an array??? - print("named: {}, x: {}, y: {}, argument0: {}, argument1: {}", argument0, argument1) +function test(func, expected, msg) { + res = func() + if res != expected { + print("test '{}' failed: {} != {}", msg, res, expected) + } +} + +function testVariadic(args...) { + result = 0 + for arg in args { + result += arg + } + return result } +test(testVariadic(1, 2, 3, 4, 5, 6, 7), 1 + 2 + 3 + 4 + 5 + 6 + 7, "variadic sum") +function vararg(named, x, y, args...) { + print("named: {}, x: {}, y: {}, args[0]: {}, args[1]: {}", args[0], args[1]) +} vararg("hi", 5, true, "six", y = 6, ball) diff --git a/swipe-vscode/syntaxes/swipe.tmLanguage.json b/swipe-vscode/syntaxes/swipe.tmLanguage.json index aa532ab9..762974dc 100644 --- a/swipe-vscode/syntaxes/swipe.tmLanguage.json +++ b/swipe-vscode/syntaxes/swipe.tmLanguage.json @@ -114,7 +114,7 @@ }, { "name": "constant.language.swipe", - "match": "\\b((argument[0-9]*)|arguments|namedArguments|this)\\b" + "match": "\\b(arguments|this)\\b" }, { "name": "constant.language.swipe",