Skip to content

Commit 25c105e

Browse files
committed
chore(test): update
1 parent c086b68 commit 25c105e

2 files changed

Lines changed: 24 additions & 18 deletions

File tree

testplay/mock/README.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# testplay/mock/
2+
3+
`testplay/` でのローカル動作確認に使うサンプルファイル群。
4+
`testplay/test.ps1` によって `testplay/run/` にコピーされてから Indentier が実行される。
5+
6+
## ファイル一覧
7+
8+
<!-- prettier-ignore -->
9+
| ファイル | 言語 |
10+
|-|-|
11+
| sample.java | Java |
12+
13+
## 使い方
14+
15+
<!-- prettier-ignore -->
16+
```sh
17+
pnpm build # このパッケージと indentier/ 両方でビルド
18+
19+
# default モード(全ファイル表示)
20+
pnpm play
21+
```
22+
23+
> **Note:** Java は ruby モード非対応(`rubyCompatible: false`)のため `pnpm play:ruby``pnpm play` と同じ結果になります。

testplay/test.ps1

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,3 @@
1-
# testplay/test.ps1
2-
# mock/ をコピーして run/ に対して indentier + このプラグインを実行するテストスクリプト
3-
#
4-
# 使い方:
5-
# .\testplay\test.ps1 # default モード、全ファイルを表示
6-
# .\testplay\test.ps1 --mode=ruby # ruby モード
7-
# .\testplay\test.ps1 --show sample.rs # 特定ファイルの結果のみ表示
8-
#
9-
# --show <file> は複数指定可。省略時は全ファイルを表示。
10-
# それ以外の引数はすべて indentier にそのまま渡される。
11-
#
12-
# 前提: このパッケージと indentier/ 両方で pnpm build を実行しておくこと。
13-
141
$PackageDir = Split-Path $PSScriptRoot -Parent
152
$IndentierDir = Join-Path (Split-Path $PackageDir -Parent) "indentier"
163
$MockDir = Join-Path $PSScriptRoot "mock"
@@ -31,17 +18,14 @@ while ($i -lt $args.Count) {
3118
$i++
3219
}
3320

34-
# --- run/ をリフレッシュ ---
3521
if (Test-Path $RunDir) { Remove-Item $RunDir -Recurse -Force }
3622
Copy-Item $MockDir $RunDir -Recurse
3723
Write-Host "Copied mock/ -> run/" -ForegroundColor Cyan
3824

39-
# --- プラグイン設定を run/ に配置 (indentier/dist/ 起点の相対パス、BOM なし UTF-8) ---
4025
$pluginName = Split-Path $PackageDir -Leaf
4126
$configPath = Join-Path $RunDir ".indentierrc.json"
4227
[System.IO.File]::WriteAllText($configPath, "{`"plugins`":[`"../../$pluginName/dist/index.mjs`"]}", [System.Text.UTF8Encoding]::new($false))
4328

44-
# --- indentier 実行 2回 (idempotency 確認) ---
4529
$cmdArgs = @("$Cli", '--write', '.') + $IndentierArgs
4630
foreach ($n in 1, 2) {
4731
Write-Host "Running ($n/2): node $($cmdArgs -join ' ') (cwd: $RunDir)" -ForegroundColor Cyan
@@ -50,7 +34,6 @@ foreach ($n in 1, 2) {
5034
Pop-Location
5135
}
5236

53-
# --- 結果表示 ---
5437
$filesToShow = if ($Show.Count -gt 0) {
5538
$Show | ForEach-Object { Join-Path $RunDir $_ }
5639
} else {
@@ -65,4 +48,4 @@ foreach ($f in $filesToShow) {
6548
} else {
6649
Write-Host "Not found: $f" -ForegroundColor Red
6750
}
68-
}
51+
}

0 commit comments

Comments
 (0)