From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id sH5pK6nSQGbZPwAAqHPOHw:P1 (envelope-from ) for ; Sun, 12 May 2024 16:31:05 +0200 Received: from aspmx1.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0.migadu.com with LMTPS id sH5pK6nSQGbZPwAAqHPOHw (envelope-from ) for ; Sun, 12 May 2024 16:31:05 +0200 X-Envelope-To: patches@johnnyrichard.com Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=lists.sr.ht header.s=20240113 header.b=kPYQ5QKU; dkim=pass header.d=maniero.me header.s=hostingermail1 header.b=NDj7CvyR; spf=pass (aspmx1.migadu.com: domain of lists@sr.ht designates 46.23.81.152 as permitted sender) smtp.mailfrom=lists@sr.ht; dmarc=pass (policy=none) header.from=maniero.me; arc=pass ("mailchannels.net:s=arc-2022:i=1") ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=johnnyrichard.com; s=key1; t=1715524265; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=T9ikWrA42T1DneTOdBrR2Qg9Iz6D3A7dkJ1gdDntqS8=; b=vxBFWa9imeJAQziCVI9plJx6MhaFmXFKYz32q7kFR8ljGs70B6obmZVB99XGKGTpcGY/JE sf2lhZJ6a0El10fhikgrMTjdXU01DsqdESM6FUDZEHBlPccyePPMXd5yaOQbvMqoNY+yLq Qsb28/azssOyYzkekSnpCm3S4URqjiivdeYmznp3LuygeTjGN4pMsAGfiXlIFRYaIKi+u+ csFTIqpCeYpfsVE4qWsrh3oNteIlP3A+W3vVGPFpXGPMP5lIRvuOtRhgvY0ySkU2dKMRQf 1T+YuB1wTY8O1MdysAxD20R5m5jzcqBOeMiJ76k3ls9qcI/PZM3CfRTZGig2ug== ARC-Authentication-Results: i=2; aspmx1.migadu.com; dkim=pass header.d=lists.sr.ht header.s=20240113 header.b=kPYQ5QKU; dkim=pass header.d=maniero.me header.s=hostingermail1 header.b=NDj7CvyR; spf=pass (aspmx1.migadu.com: domain of lists@sr.ht designates 46.23.81.152 as permitted sender) smtp.mailfrom=lists@sr.ht; dmarc=pass (policy=none) header.from=maniero.me; arc=pass ("mailchannels.net:s=arc-2022:i=1") ARC-Seal: i=2; s=key1; d=johnnyrichard.com; t=1715524265; a=rsa-sha256; cv=pass; b=K+rSrtxQIR1lBO+D1tGtjPkhYehTT1XRx7i3iTUWERRKQnfG5h6EZuEAtW6Pv8ifs204lv IFLNJ94nuT6vP0AVG7XkyN6WhhAfaMmn2R4U6t92RDjX2nxX5i0I8b4Pa30EgFKjcATDd2 NhS7iUUTvvH0G1ugucOdTk3N+OHxhYYLQ+5x8+/4y9+LfABcljGslcFlV+fC86iLcsZfv2 z0uvpCEhOIEg/g7hHLf1Qeoy1nzYhcg9H8lyGfeLkGrHR6Tw1uaRfUGZG47jVH2cqXdAGj ThvBs4VjJDF2lCabO7aIXbivyL74hOPk5bBHog1qL4W0dVbZS26BI6Arme+qmg== Received: from mail-a.sr.ht (mail-a.sr.ht [46.23.81.152]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 9E3C18B0A for ; Sun, 12 May 2024 16:31:02 +0200 (CEST) DKIM-Signature: a=rsa-sha256; bh=PAp4l6+3VIu/xL8LuwimNPOZfFxITCUf3f7ejDR3AZ4=; c=simple/simple; d=lists.sr.ht; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Unsubscribe:List-Subscribe:List-Archive:List-Post:List-ID; q=dns/txt; s=20240113; t=1715524262; v=1; b=kPYQ5QKUajGBanY+dakw/SkOyRVLkXmoQ5K7mDx6P4NX2zYAu63v56OqxQh8mHRjfItmTdIY sZjdVaLbVww6m/OqxKYUR5rNhVXIFNf996ciK0eqWDrRD1P3vUnC/nAxL00QEXHVA55DnxpTtKe Wqjm4OhXH+9TgNQzEPVIzF1J4XTa+NKueSMg2POEoAqkoIFB4z/3rXktKPpAcAcS+Nhu0NYvSta N7CgjMW3IgL/ZgFgTBaOha2fxWn7HE8hLSm4zc4kAXmTl+PnILBTuNWSYTiwvzScZ2ARtjmCqCj wiK2trNLJPOd6XoqF5bUbeZ6QoRxULjljj6J8tsc6lu8g== Received: from lists.sr.ht (unknown [IPv6:2a03:6000:1813:1337::154]) by mail-a.sr.ht (Postfix) with ESMTPSA id 5E50520132 for ; Sun, 12 May 2024 14:31:02 +0000 (UTC) Received: from bee.birch.relay.mailchannels.net (bee.birch.relay.mailchannels.net [23.83.209.14]) by mail-a.sr.ht (Postfix) with ESMTPS id 7386D20119 for <~johnnyrichard/olang-devel@lists.sr.ht>; Sun, 12 May 2024 14:31:01 +0000 (UTC) X-Sender-Id: hostingeremail|x-authuser|carlos@maniero.me Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id B063390184A for <~johnnyrichard/olang-devel@lists.sr.ht>; Sun, 12 May 2024 14:30:52 +0000 (UTC) Received: from nl-srv-smtpout1.hostinger.io (unknown [127.0.0.6]) (Authenticated sender: hostingeremail) by relay.mailchannels.net (Postfix) with ESMTPA id EB282901C0C for <~johnnyrichard/olang-devel@lists.sr.ht>; Sun, 12 May 2024 14:30:51 +0000 (UTC) ARC-Seal: i=1; s=arc-2022; d=mailchannels.net; t=1715524252; a=rsa-sha256; cv=none; b=3zK8SOw0DGl9t4a+ze/AhzdKLQPaMgMNtJQ+R5Of/eAkhZ5/GdHaTRZ7cnNQPX0zZLfcUv yJgTwDm/tRsAvvhXwy6BLvcDWBXhjutuoi9gLcN19O7Y9z8p3JaNZw6fSa7FYB4u/XbaEm pLTVORWvwRgF09/bHMA5d0EfSl1z4r8tfS6bqYh5Lg0RDmPmEe/Eui/gXzJ9wewl3+TR9t xui/ABC7fwtFvo3P1/Ds2rzxmI6rSWw0ganWxaAnfuW457J9dgq92oHhiK1BNa7n7xCFHr EF5GPC72HIb2Qqebi4T/IGY0QMf40qFNm+m+S5bXo0++IOP03lLarQAVfIq8Jw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=mailchannels.net; s=arc-2022; t=1715524252; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=T9ikWrA42T1DneTOdBrR2Qg9Iz6D3A7dkJ1gdDntqS8=; b=kd2jE4/jz8161RcPtKwfsAxqjjPjJH7qogV6msgYxDFQDcOBC1QaNoF83Mpbe9IaWTvgwV etg7+dUfeDsdTZJwL+LbH1naWmGgyuuSgxhtW8tfIJY5wx2gQkrnFQzLpkFO/IqN60aGGB zjlxOtA4LHbOrLNCwTvyJrALUqFimGctQZyXGQ1ZUv1CJb+ZX0ZjlchRnQ0pJbDEj/Oz2e jX+ezQpwy4O9lUd4zlhe6Iz2nL/lDLSRMi7jAc2PxVKxhkTIS9PMh0+QWYJCKCLLsIvE5U 1HtkZkbawt9/e2U+xFum3VS2IzR/w43PuIZMwJbAJAaPugX5nSxwu06Ogbxilw== ARC-Authentication-Results: i=1; rspamd-5d55749bb4-8ql8m; auth=pass smtp.auth=hostingeremail smtp.mailfrom=carlos@maniero.me X-Sender-Id: hostingeremail|x-authuser|carlos@maniero.me X-MC-Relay: Neutral X-MailChannels-SenderId: hostingeremail|x-authuser|carlos@maniero.me X-MailChannels-Auth-Id: hostingeremail X-Juvenile-Reaction: 24f19aee0c196513_1715524252603_2559009615 X-MC-Loop-Signature: 1715524252603:1199084851 X-MC-Ingress-Time: 1715524252603 Received: from nl-srv-smtpout1.hostinger.io (nl-srv-smtpout1.hostinger.io [145.14.150.87]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384) by 100.106.115.198 (trex/6.9.2); Sun, 12 May 2024 14:30:52 +0000 From: Carlos Maniero DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=maniero.me; s=hostingermail1; t=1715524250; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=T9ikWrA42T1DneTOdBrR2Qg9Iz6D3A7dkJ1gdDntqS8=; b=NDj7CvyRCDWHdvfhJKOcG8WlMLEygxSG9DgRuh/ylgsk20sBQ7rq2r4xWkNT8SbO4dqu36 jAmaBwqWUzwC8L0mU4GKNYU1M/BMKim6ICUnbToC4zxg414xQr4KwTGhTWJDwdgN4eOPJz x7+FVcxdZ5Wu95BB2jn3jaRTThZa+jK8fI3VzLs/tjOWAAjA0r6TPvXN/SVLz39fpui02w 2LgH7lwjaHWn8yujWNykg81O/lKjtb8UHxqBZYChw2nuJxpxtJlCItiuRth/Vjw3yapHyF UPdtg6Y3WVAJ948sLIqKl6vLGu/TIljPpbFyy+feKU46hF6rAwOz5r/oRBrGmg== To: ~johnnyrichard/olang-devel@lists.sr.ht Cc: Carlos Maniero Subject: [PATCH olang 3/4] tests: include integration tests for function parser errors Date: Sun, 12 May 2024 11:30:32 -0300 Message-Id: <20240512143033.229961-4-carlos@maniero.me> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240512143033.229961-1-carlos@maniero.me> References: <20240512143033.229961-1-carlos@maniero.me> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-Analysis: v=2.4 cv=WIUtXWsR c=1 sm=1 tr=0 ts=6640d29a a=WwxFCuf3mf1fs3oSi6/dng==:117 a=WwxFCuf3mf1fs3oSi6/dng==:17 a=MKtGQD3n3ToA:10 a=1oJP67jkp3AA:10 a=JZH_oxuKkqAYE12550EA:9 a=BXDaF_L80NY05PYiAFlV:22 X-CM-Envelope: MS4xfKl1DtrpNWa2YeU3aGHD/GPu0WPsNjUTO2b+UtWPWOF9YOu61DyIU2jhmFe5dxNSZqTeKTkqDaRYZk3Mx+i4PLn0/9zUIGbHF+3Ady9geVqmf/Vbmkl8 zpR9sdGQ2sU1WNgPQy6LmonIimUY62LxE9UF0CG4PKGfzFb4bveX+ud0D1dqjpPeo6GgeugQTjhWeNSvViMUk7e+QiRjDnCNYdFUhjwneguaBeZr30SlZwzS X-AuthUser: carlos@maniero.me X-Sourcehut-Patchset-Status: UNKNOWN List-Unsubscribe: List-Subscribe: List-Archive: Archived-At: List-Post: List-ID: ~johnnyrichard/olang-devel <~johnnyrichard/olang-devel.lists.sr.ht> Sender: ~johnnyrichard/olang-devel <~johnnyrichard/olang-devel@lists.sr.ht> X-Migadu-Country: NL X-Migadu-Flow: FLOW_IN X-Spam-Score: -10.12 X-Migadu-Queue-Id: 9E3C18B0A X-Migadu-Scanner: mx10.migadu.com X-Migadu-Spam-Score: -10.12 X-TUID: J7rI8TLoavQX This new tests covers the parser errors we support. Signed-off-by: Carlos Maniero --- tests/integration/tests/0002_fn_without_fn_keyword.ol | 8 ++++++++ tests/integration/tests/0003_fn_without_type.ol | 8 ++++++++ tests/integration/tests/0004_fn_without_type_colon.ol | 8 ++++++++ .../tests/0005_fn_without_open_curly_brackets.ol | 8 ++++++++ .../tests/0006_fn_without_close_curly_brackets.ol | 7 +++++++ tests/integration/tests/0007_fn_without_return.ol | 8 ++++++++ 6 files changed, 47 insertions(+) create mode 100644 tests/integration/tests/0002_fn_without_fn_keyword.ol create mode 100644 tests/integration/tests/0003_fn_without_type.ol create mode 100644 tests/integration/tests/0004_fn_without_type_colon.ol create mode 100644 tests/integration/tests/0005_fn_without_open_curly_brackets.ol create mode 100644 tests/integration/tests/0006_fn_without_close_curly_brackets.ol create mode 100644 tests/integration/tests/0007_fn_without_return.ol diff --git a/tests/integration/tests/0002_fn_without_fn_keyword.ol b/tests/integration/tests/0002_fn_without_fn_keyword.ol new file mode 100644 index 0000000..f1ad57e --- /dev/null +++ b/tests/integration/tests/0002_fn_without_fn_keyword.ol @@ -0,0 +1,8 @@ +# spec: An invalid program with no fn keyword +main(): u32 { + return 0 +} +# compiler_exit: 1 +# compiler_output: ./tests/0002_fn_without_fn_keyword.ol:2:1: error: got 'main' token but expect +# compiler_output: main(): u32 { +# compiler_output: ^ diff --git a/tests/integration/tests/0003_fn_without_type.ol b/tests/integration/tests/0003_fn_without_type.ol new file mode 100644 index 0000000..32716e1 --- /dev/null +++ b/tests/integration/tests/0003_fn_without_type.ol @@ -0,0 +1,8 @@ +# spec: An invalid program with no type +fn main(): { + return 0 +} +# compiler_exit: 1 +# compiler_output: ./tests/0003_fn_without_type.ol:2:12: error: got '{' token but expect +# compiler_output: fn main(): { +# compiler_output: ^ diff --git a/tests/integration/tests/0004_fn_without_type_colon.ol b/tests/integration/tests/0004_fn_without_type_colon.ol new file mode 100644 index 0000000..bd04c37 --- /dev/null +++ b/tests/integration/tests/0004_fn_without_type_colon.ol @@ -0,0 +1,8 @@ +# spec: An invalid program with no type colon +fn main() u32 { + return 0 +} +# compiler_exit: 1 +# compiler_output: ./tests/0004_fn_without_type_colon.ol:2:11: error: got 'u32' token but expect <:> +# compiler_output: fn main() u32 { +# compiler_output: ^ diff --git a/tests/integration/tests/0005_fn_without_open_curly_brackets.ol b/tests/integration/tests/0005_fn_without_open_curly_brackets.ol new file mode 100644 index 0000000..8e13946 --- /dev/null +++ b/tests/integration/tests/0005_fn_without_open_curly_brackets.ol @@ -0,0 +1,8 @@ +# spec: An invalid program with no open curly brackets +fn main(): u32 + return 0 +} +# compiler_exit: 1 +# compiler_output: ./tests/0005_fn_without_open_curly_brackets.ol:3:3: error: got 'return' token but expect <{> +# compiler_output: return 0 +# compiler_output: ^ diff --git a/tests/integration/tests/0006_fn_without_close_curly_brackets.ol b/tests/integration/tests/0006_fn_without_close_curly_brackets.ol new file mode 100644 index 0000000..d43c9f9 --- /dev/null +++ b/tests/integration/tests/0006_fn_without_close_curly_brackets.ol @@ -0,0 +1,7 @@ +# spec: An invalid program with no close curly brackets +fn main(): u32 { + return 0 +# compiler_exit: 1 +# compiler_output: ./tests/0006_fn_without_close_curly_brackets.ol:8:1: error: got '' token but expect <}> +# compiler_output: +# compiler_output: ^ diff --git a/tests/integration/tests/0007_fn_without_return.ol b/tests/integration/tests/0007_fn_without_return.ol new file mode 100644 index 0000000..fe33d69 --- /dev/null +++ b/tests/integration/tests/0007_fn_without_return.ol @@ -0,0 +1,8 @@ +# spec: An invalid program without return statment +# TODO: Improve the compiler error message +fn main(): u32 { +} +# compiler_exit: 1 +# compiler_output: ./tests/0007_fn_without_return.ol:4:1: error: got '}' token but expect +# compiler_output: } +# compiler_output: ^ -- 2.34.1