Skip to content

Commit

Permalink
tests for language detection
Browse files Browse the repository at this point in the history
  • Loading branch information
ambhrin-slalom committed Apr 24, 2024
1 parent 7fcc283 commit 997ded2
Show file tree
Hide file tree
Showing 10 changed files with 94 additions and 0 deletions.
9 changes: 9 additions & 0 deletions tests/end-to-end/test-data/Csharp_Sample/src/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
using System;

class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello, world!");
}
}
7 changes: 7 additions & 0 deletions tests/end-to-end/test-data/Go_Sample/src/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package main

import "fmt"

func main() {
fmt.Println("Hello, world!")
}
11 changes: 11 additions & 0 deletions tests/end-to-end/test-data/JavaScript_Sample/public/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>JavaScript_Sample</title>
</head>
<body>
<script src="index.js"></script>
</body>
</html>
1 change: 1 addition & 0 deletions tests/end-to-end/test-data/JavaScript_Sample/src/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
console.log("Hello, world!");
1 change: 1 addition & 0 deletions tests/end-to-end/test-data/Kotlin_Sample/src/Main.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
fun main() { println("Hello, world!") }
1 change: 1 addition & 0 deletions tests/end-to-end/test-data/Python_Sample/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
print("Hello, world!")
1 change: 1 addition & 0 deletions tests/end-to-end/test-data/Swift_Sample/Sources/main.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
print("Hello, world!")
1 change: 1 addition & 0 deletions tests/end-to-end/test-data/Terraform_Sample/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
output "hello_world" { value = "Hello, world!" }
1 change: 1 addition & 0 deletions tests/end-to-end/test-data/TypeScript_Sample/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
console.log("Hello, world!");
61 changes: 61 additions & 0 deletions tests/end-to-end/test-language-detect.bats
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
setup() {
load "${BATS_LIBS_ROOT}/bats-support/load"
load "${BATS_LIBS_ROOT}/bats-assert/load"
}

@test "can detect C# language" {
#cd tests/end-to-end/test-data/Csharp_Sample/
run python secureli/main.py init -ry
assert_output --partial '[seCureLI] The following language(s) support secrets detection: C#'
assert_output --partial '[seCureLI] - C#: 100%'
}

@test "can detect Go language" {
#cd tests/end-to-end/test-data/Go_Sample/
run python secureli/main.py init -ry
assert_output --partial '[seCureLI] - Go: 100%'
assert_output --partial '[seCureLI] seCureLI has been installed successfully for the following language(s): Go.'
}

@test "can detect Javascript language" {
#cd tests/end-to-end/test-data/JavaScript_Sample/
run python secureli/main.py init -ry
assert_output --partial '[seCureLI] - JavaScript: 100%'
assert_output --partial '[seCureLI] seCureLI has been installed successfully for the following language(s): JavaScript.'
}

@test "can detect Kotlin language" {
#cd tests/end-to-end/test-data/Kotlin_Sample/
run python secureli/main.py init -ry
assert_output --partial '[seCureLI] - Kotlin: 100%'
assert_output --partial '[seCureLI] seCureLI has been installed successfully for the following language(s): Kotlin.'
assert_output --partial '[seCureLI] seCureLI has been installed successfully for the following language(s): Kotlin.'
}

@test "can detect Python language" {
#cd tests/end-to-end/test-data/Python_Sample/
run python secureli/main.py init -ry
assert_output --partial '[seCureLI] - Python: 100%'
assert_output --partial '[seCureLI] seCureLI has been installed successfully for the following language(s): Python.'
}

@test "can detect Swift language" {
#cd tests/end-to-end/test-data/Swift_Sample/
run python secureli/main.py init -ry
assert_output --partial '[seCureLI] seCureLI has been installed successfully for the following language(s): Swift.'
assert_output --partial '[seCureLI] - Swift: 100%'
}

@test "can detect Terraform language" {
#cd tests/end-to-end/test-data/Terraform_Sample/
run python secureli/main.py init -ry
assert_output --partial '[seCureLI] - Terraform: 100%'
assert_output --partial '[seCureLI] seCureLI has been installed successfully for the following language(s): Terraform.'
}

@test "can detect Typescript language" {
#cd tests/end-to-end/test-data/Typescript_Sample/
run python secureli/main.py init -ry
assert_output --partial '[seCureLI] - TypeScript: 100%'
assert_output --partial '[seCureLI] seCureLI has been installed successfully for the following language(s): TypeScript.cd ..'
}

0 comments on commit 997ded2

Please sign in to comment.