mirror of
https://github.com/hustcer/deepseek-review.git
synced 2026-05-13 05:16:05 +08:00
deps: Upgrade nutest to v1.1.0 (#179)
* deps: Upgrade nutest to v1.1.0 * fix nutest upgrading
This commit is contained in:
3
.github/workflows/tests.yml
vendored
3
.github/workflows/tests.yml
vendored
@@ -15,6 +15,7 @@ on:
|
|||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
- develop
|
- develop
|
||||||
|
- feature/test
|
||||||
paths-ignore:
|
paths-ignore:
|
||||||
- '**.md'
|
- '**.md'
|
||||||
- 'docs/**'
|
- 'docs/**'
|
||||||
@@ -46,7 +47,7 @@ jobs:
|
|||||||
- name: Checkout Nutest Repo
|
- name: Checkout Nutest Repo
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
ref: v1.0.1
|
ref: v1.1.0
|
||||||
path: nutest
|
path: nutest
|
||||||
repository: vyadh/nutest
|
repository: vyadh/nutest
|
||||||
sparse-checkout: nutest/
|
sparse-checkout: nutest/
|
||||||
|
|||||||
@@ -1,39 +1,40 @@
|
|||||||
|
|
||||||
use std/assert
|
use std/assert
|
||||||
|
use std/testing *
|
||||||
|
|
||||||
use ../nu/common.nu [
|
use ../nu/common.nu [
|
||||||
compare-ver, 'from env', is-installed, has-ref,
|
compare-ver, 'from env', is-installed, has-ref,
|
||||||
git-check, compact-record, is-repo, windows?, mac?,
|
git-check, compact-record, is-repo, windows?, mac?,
|
||||||
]
|
]
|
||||||
|
|
||||||
#[test]
|
@test
|
||||||
def 'compare-ver:v1.0.0 is greater than v0.999.0' [] {
|
def 'compare-ver:v1.0.0 is greater than v0.999.0' [] {
|
||||||
assert equal (compare-ver 1.0.0 0.999.0) 1
|
assert equal (compare-ver 1.0.0 0.999.0) 1
|
||||||
assert equal (compare-ver v1.0.0 v0.999.0) 1
|
assert equal (compare-ver v1.0.0 v0.999.0) 1
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
@test
|
||||||
def 'compare-ver:v1.0.1 is equal to v1.0.1' [] {
|
def 'compare-ver:v1.0.1 is equal to v1.0.1' [] {
|
||||||
assert equal (compare-ver 1.0.1 1.0.1) 0
|
assert equal (compare-ver 1.0.1 1.0.1) 0
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
@test
|
||||||
def 'compare-ver:v1.0.0 is equal to v1' [] {
|
def 'compare-ver:v1.0.0 is equal to v1' [] {
|
||||||
assert equal (compare-ver v1.0.0 v1) 0
|
assert equal (compare-ver v1.0.0 v1) 0
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
@test
|
||||||
def 'compare-ver:v1.0.1 is greater than v1' [] {
|
def 'compare-ver:v1.0.1 is greater than v1' [] {
|
||||||
assert equal (compare-ver v1.0.1 v1) 1
|
assert equal (compare-ver v1.0.1 v1) 1
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
@test
|
||||||
def 'compare-ver:v1.0.1 is lower than v1.1.0' [] {
|
def 'compare-ver:v1.0.1 is lower than v1.1.0' [] {
|
||||||
assert less (compare-ver 1.0.1 v1.1) 0
|
assert less (compare-ver 1.0.1 v1.1) 0
|
||||||
assert equal (compare-ver 1.0.1 1.1.0) (-1)
|
assert equal (compare-ver 1.0.1 1.1.0) (-1)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
@test
|
||||||
def 'from-env:.env load should work' [] {
|
def 'from-env:.env load should work' [] {
|
||||||
open tests/resources/.env.test | from env | load-env
|
open tests/resources/.env.test | from env | load-env
|
||||||
assert equal $env.CHAT_MODEL deepseek-chat
|
assert equal $env.CHAT_MODEL deepseek-chat
|
||||||
@@ -43,35 +44,35 @@ def 'from-env:.env load should work' [] {
|
|||||||
assert equal $env.USER_PROMPT 'Please review the following code changes'
|
assert equal $env.USER_PROMPT 'Please review the following code changes'
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
@test
|
||||||
def 'is-installed:binary install check should work' [] {
|
def 'is-installed:binary install check should work' [] {
|
||||||
assert equal (is-installed git) true
|
assert equal (is-installed git) true
|
||||||
assert equal (is-installed abc) false
|
assert equal (is-installed abc) false
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
@test
|
||||||
def 'has-ref:git repo should has HEAD ref' [] {
|
def 'has-ref:git repo should has HEAD ref' [] {
|
||||||
assert equal (has-ref HEAD) true
|
assert equal (has-ref HEAD) true
|
||||||
assert equal (has-ref 0000) false
|
assert equal (has-ref 0000) false
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
@test
|
||||||
def 'is-repo:current dir is a git repo' [] {
|
def 'is-repo:current dir is a git repo' [] {
|
||||||
assert equal (is-repo) true
|
assert equal (is-repo) true
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
@test
|
||||||
def 'git-check:current dir is a git repo' [] {
|
def 'git-check:current dir is a git repo' [] {
|
||||||
assert equal (git-check (pwd) --check-repo=1) true
|
assert equal (git-check (pwd) --check-repo=1) true
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
@test
|
||||||
def 'compact-record:should work as expected' [] {
|
def 'compact-record:should work as expected' [] {
|
||||||
assert equal ({a: null, b: '', c: 'abc' } | compact-record) { c: 'abc' }
|
assert equal ({a: null, b: '', c: 'abc' } | compact-record) { c: 'abc' }
|
||||||
assert equal ({a: null, b: 0, c: 1, e: { f: 'g' } } | compact-record) { b: 0, c: 1, e: { f: 'g' } }
|
assert equal ({a: null, b: 0, c: 1, e: { f: 'g' } } | compact-record) { b: 0, c: 1, e: { f: 'g' } }
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
@test
|
||||||
def 'OS check should work as expected' [] {
|
def 'OS check should work as expected' [] {
|
||||||
# `$env.RUNNER_OS` Possible values are Linux, Windows, or macOS in GitHub Actions
|
# `$env.RUNNER_OS` Possible values are Linux, Windows, or macOS in GitHub Actions
|
||||||
match $nu.os-info.name {
|
match $nu.os-info.name {
|
||||||
|
|||||||
@@ -1,12 +1,13 @@
|
|||||||
|
|
||||||
use std/assert
|
use std/assert
|
||||||
|
use std/testing *
|
||||||
use ../nu/diff.nu [get-diff]
|
use ../nu/diff.nu [get-diff]
|
||||||
use ../nu/util.nu [is-safe-git, prepare-awk, generate-include-regex, generate-exclude-regex]
|
use ../nu/util.nu [is-safe-git, prepare-awk, generate-include-regex, generate-exclude-regex]
|
||||||
|
|
||||||
# Get the unicode width of the input string
|
# Get the unicode width of the input string
|
||||||
def get-uw [] { $in | str stats | get unicode-width }
|
def get-uw [] { $in | str stats | get unicode-width }
|
||||||
|
|
||||||
#[before-all]
|
@before-all
|
||||||
def setup [] {
|
def setup [] {
|
||||||
let awk_bin = (prepare-awk)
|
let awk_bin = (prepare-awk)
|
||||||
let patch = open -r tests/resources/diff.patch
|
let patch = open -r tests/resources/diff.patch
|
||||||
@@ -14,7 +15,7 @@ def setup [] {
|
|||||||
{ patch: $patch, awk: $awk_bin, SHA: 22e7b71 }
|
{ patch: $patch, awk: $awk_bin, SHA: 22e7b71 }
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
@test
|
||||||
def 'is-safe-git:should work as expected' [] {
|
def 'is-safe-git:should work as expected' [] {
|
||||||
assert equal (is-safe-git 'git diff') true
|
assert equal (is-safe-git 'git diff') true
|
||||||
assert equal (is-safe-git 'git show') true
|
assert equal (is-safe-git 'git show') true
|
||||||
@@ -45,7 +46,7 @@ def 'is-safe-git:should work as expected' [] {
|
|||||||
assert equal (is-safe-git 'git show HEAD:nu/common.nu') true
|
assert equal (is-safe-git 'git show HEAD:nu/common.nu') true
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
@test
|
||||||
def 'generate-include-regex:should work as expected' [] {
|
def 'generate-include-regex:should work as expected' [] {
|
||||||
let patch = $in.patch
|
let patch = $in.patch
|
||||||
let awk_bin = $in.awk
|
let awk_bin = $in.awk
|
||||||
@@ -55,7 +56,7 @@ def 'generate-include-regex:should work as expected' [] {
|
|||||||
assert equal ($patch | ^$awk_bin (generate-include-regex [.env*, *.md, nu/*]) | get-uw) 6871
|
assert equal ($patch | ^$awk_bin (generate-include-regex [.env*, *.md, nu/*]) | get-uw) 6871
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
@test
|
||||||
def 'generate-exclude-regex:should work as expected' [] {
|
def 'generate-exclude-regex:should work as expected' [] {
|
||||||
let patch = $in.patch
|
let patch = $in.patch
|
||||||
let awk_bin = $in.awk
|
let awk_bin = $in.awk
|
||||||
@@ -63,7 +64,7 @@ def 'generate-exclude-regex:should work as expected' [] {
|
|||||||
assert equal ($patch | ^$awk_bin (generate-exclude-regex [.env*, *.md, nu/*]) | get-uw) (1350 + 99)
|
assert equal ($patch | ^$awk_bin (generate-exclude-regex [.env*, *.md, nu/*]) | get-uw) (1350 + 99)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
@test
|
||||||
def 'both include and exclude should work as expected' [] {
|
def 'both include and exclude should work as expected' [] {
|
||||||
let patch = $in.patch
|
let patch = $in.patch
|
||||||
let awk_bin = $in.awk
|
let awk_bin = $in.awk
|
||||||
@@ -73,7 +74,7 @@ def 'both include and exclude should work as expected' [] {
|
|||||||
| get-uw) 2576
|
| get-uw) 2576
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
@test
|
||||||
def 'both exclude and include should work as expected' [] {
|
def 'both exclude and include should work as expected' [] {
|
||||||
let patch = $in.patch
|
let patch = $in.patch
|
||||||
let awk_bin = $in.awk
|
let awk_bin = $in.awk
|
||||||
@@ -83,7 +84,7 @@ def 'both exclude and include should work as expected' [] {
|
|||||||
| get-uw) 2576
|
| get-uw) 2576
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
@test
|
||||||
def 'get-diff:get patch from remote PR should work' [] {
|
def 'get-diff:get patch from remote PR should work' [] {
|
||||||
$env.GH_TOKEN = $env.GITHUB_TOKEN?
|
$env.GH_TOKEN = $env.GITHUB_TOKEN?
|
||||||
const repo = 'hustcer/deepseek-review'
|
const repo = 'hustcer/deepseek-review'
|
||||||
@@ -93,7 +94,7 @@ def 'get-diff:get patch from remote PR should work' [] {
|
|||||||
| str join "\n" | get-uw) 7923
|
| str join "\n" | get-uw) 7923
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
@test
|
||||||
def 'get-diff:get patch from remote PR with include should work' [] {
|
def 'get-diff:get patch from remote PR with include should work' [] {
|
||||||
$env.GH_TOKEN = $env.GITHUB_TOKEN?
|
$env.GH_TOKEN = $env.GITHUB_TOKEN?
|
||||||
const repo = 'hustcer/deepseek-review'
|
const repo = 'hustcer/deepseek-review'
|
||||||
@@ -102,7 +103,7 @@ def 'get-diff:get patch from remote PR with include should work' [] {
|
|||||||
assert equal ($patch | get-uw) 2576
|
assert equal ($patch | get-uw) 2576
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
@test
|
||||||
def 'get-diff:get patch from remote PR with exclude should work' [] {
|
def 'get-diff:get patch from remote PR with exclude should work' [] {
|
||||||
$env.GH_TOKEN = $env.GITHUB_TOKEN?
|
$env.GH_TOKEN = $env.GITHUB_TOKEN?
|
||||||
const repo = 'hustcer/deepseek-review'
|
const repo = 'hustcer/deepseek-review'
|
||||||
@@ -111,7 +112,7 @@ def 'get-diff:get patch from remote PR with exclude should work' [] {
|
|||||||
assert equal ($patch | get-uw) 555
|
assert equal ($patch | get-uw) 555
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
@test
|
||||||
def 'get-diff:get patch from remote PR with exclude & include should work' [] {
|
def 'get-diff:get patch from remote PR with exclude & include should work' [] {
|
||||||
$env.GH_TOKEN = $env.GITHUB_TOKEN?
|
$env.GH_TOKEN = $env.GITHUB_TOKEN?
|
||||||
const repo = 'hustcer/deepseek-review'
|
const repo = 'hustcer/deepseek-review'
|
||||||
|
|||||||
Reference in New Issue
Block a user