From dadb4aaf1e7659e328097f6fb8e5c239f1e9a66c Mon Sep 17 00:00:00 2001 From: Colton Donnelly Date: Tue, 24 Oct 2023 17:24:39 -0400 Subject: [PATCH] more guess tests (#145) * add regression test for #109 * forgot to include python guess files * add tests to test suite --- test-suite/Guess_test.go | 3 +++ test-suite/templates/guess/js/esparse-fail | 7 +++++++ test-suite/templates/guess/js/esparse-fail.expect | 1 + test-suite/templates/guess/py/basic | 3 +++ test-suite/templates/guess/py/basic.expect | 3 +++ test-suite/templates/guess/py/dedup | 4 ++++ test-suite/templates/guess/py/dedup.expect | 2 ++ test-suite/templates/guess/py/replit-packages | 2 ++ test-suite/templates/guess/py/replit-packages.expect | 2 ++ 9 files changed, 27 insertions(+) create mode 100644 test-suite/templates/guess/js/esparse-fail create mode 100644 test-suite/templates/guess/js/esparse-fail.expect create mode 100644 test-suite/templates/guess/py/basic create mode 100644 test-suite/templates/guess/py/basic.expect create mode 100644 test-suite/templates/guess/py/dedup create mode 100644 test-suite/templates/guess/py/dedup.expect create mode 100644 test-suite/templates/guess/py/replit-packages create mode 100644 test-suite/templates/guess/py/replit-packages.expect diff --git a/test-suite/Guess_test.go b/test-suite/Guess_test.go index 3c183263..80e0e8e4 100644 --- a/test-suite/Guess_test.go +++ b/test-suite/Guess_test.go @@ -32,6 +32,7 @@ func TestGuess(t *testing.T) { "basic", "dedup", "nested", + "esparse-fail", } } @@ -50,6 +51,8 @@ func TestGuess(t *testing.T) { tests[ext]["py"] = []string{ "basic", + "dedup", + "replit-packages", } } diff --git a/test-suite/templates/guess/js/esparse-fail b/test-suite/templates/guess/js/esparse-fail new file mode 100644 index 00000000..5d6413a9 --- /dev/null +++ b/test-suite/templates/guess/js/esparse-fail @@ -0,0 +1,7 @@ +import express from 'express'; + +const foo = ({ + // esparse fails to parse the default argument here, + // resulting in the full guess failing + bar = () => { }, +}) => { }; diff --git a/test-suite/templates/guess/js/esparse-fail.expect b/test-suite/templates/guess/js/esparse-fail.expect new file mode 100644 index 00000000..669563aa --- /dev/null +++ b/test-suite/templates/guess/js/esparse-fail.expect @@ -0,0 +1 @@ +express diff --git a/test-suite/templates/guess/py/basic b/test-suite/templates/guess/py/basic new file mode 100644 index 00000000..7c8b97be --- /dev/null +++ b/test-suite/templates/guess/py/basic @@ -0,0 +1,3 @@ +from django.shortcuts import render +from flask import Flask +import replit.ai diff --git a/test-suite/templates/guess/py/basic.expect b/test-suite/templates/guess/py/basic.expect new file mode 100644 index 00000000..a3bd0a23 --- /dev/null +++ b/test-suite/templates/guess/py/basic.expect @@ -0,0 +1,3 @@ +django +flask +replit-ai diff --git a/test-suite/templates/guess/py/dedup b/test-suite/templates/guess/py/dedup new file mode 100644 index 00000000..73183bec --- /dev/null +++ b/test-suite/templates/guess/py/dedup @@ -0,0 +1,4 @@ +import django +from django.conf import settings +from django.shortcuts import render +from flask import Flask diff --git a/test-suite/templates/guess/py/dedup.expect b/test-suite/templates/guess/py/dedup.expect new file mode 100644 index 00000000..1c488502 --- /dev/null +++ b/test-suite/templates/guess/py/dedup.expect @@ -0,0 +1,2 @@ +django +flask diff --git a/test-suite/templates/guess/py/replit-packages b/test-suite/templates/guess/py/replit-packages new file mode 100644 index 00000000..0c784347 --- /dev/null +++ b/test-suite/templates/guess/py/replit-packages @@ -0,0 +1,2 @@ +import replit +import replit.ai diff --git a/test-suite/templates/guess/py/replit-packages.expect b/test-suite/templates/guess/py/replit-packages.expect new file mode 100644 index 00000000..295221cf --- /dev/null +++ b/test-suite/templates/guess/py/replit-packages.expect @@ -0,0 +1,2 @@ +replit +replit-ai