Skip to content

Commit 4c12a50

Browse files
committed
tests for native sml and sms added
1 parent b0dd4fb commit 4c12a50

23 files changed

Lines changed: 3078 additions & 38 deletions

AGENTS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ Repository guidance for coding agents working in Forge.
6060
- Use clear names over clever abstractions.
6161
- Keep comments concise and only where they add value.
6262
- Keep naming and APIs explicit/deterministic for tool and AI generation workflows.
63+
- Native C++ code must remain portable C++17 (avoid compiler-/platform-specific language extensions unless explicitly approved).
6364

6465
## Safety
6566
- Avoid destructive actions (mass deletes, hard resets) unless explicitly requested.

CWUP/BACKLOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@
9494

9595
## Future Tasks
9696
- [ ] Texture-Cache in `NodePropertyMapper` einbauen: `Dictionary<string, Texture2D>` nach resolved path, geteilt über alle Controls. Nur umsetzen wenn Ladezeiten > 1 Sekunde messbar sind.
97+
- [ ] tasks/stackwide_single_slash_uri_scheme_policy.md
9798

9899
## Tasks for Forge-Designer
99100
- [ ] Lifecycle-Template für neue Scripts einführen (OnInit / OnReadyAsync sichtbar als optionaler Einstieg)
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# Stack-Wide Single-Slash URI Scheme Policy
2+
3+
## Goal
4+
Define and enforce one canonical URI scheme policy across the full Forge stack:
5+
6+
- `res:/...`
7+
- `appRes:/...`
8+
- `user:/...`
9+
10+
and reject double-slash variants in Forge-controlled URI parsing paths:
11+
12+
- `res://...`
13+
- `appRes://...`
14+
- `user://...`
15+
16+
## Why
17+
- Keep path syntax simple and consistent for users and AI-generated content.
18+
- Prevent ambiguity with network-like URL mental models.
19+
- Ensure deterministic path handling behavior across Runner, Designer, Poser, docs, and tooling.
20+
21+
## Scope
22+
### Policy and specification
23+
- Document the canonical URI scheme policy in public docs and internal implementation notes.
24+
- Define normalization behavior for legacy content:
25+
- read/compat path may auto-normalize double-slash to single-slash where safe
26+
- write/output path must emit only single-slash canonical form
27+
28+
### Runtime and tooling alignment
29+
- Audit and update URI/path resolvers in:
30+
- ForgeRunner runtime systems (SML/SMS/asset resolvers)
31+
- ForgeDesigner path and template outputs
32+
- ForgePoser path handling
33+
- related tools/scripts that generate or transform paths
34+
- Ensure diagnostics clearly explain invalid double-slash inputs when strict mode is enabled.
35+
36+
### Migration and compatibility
37+
- Add an explicit migration note for existing projects using `://` forms.
38+
- Provide deterministic conversion rules with no traversal/security regression.
39+
40+
## Non-Goals
41+
- No change to HTTP/HTTPS URL handling for network APIs that are not Forge URI schemes.
42+
- No relaxation of existing sandbox/root-jail security constraints.
43+
44+
## Deliverables
45+
- Canonical policy doc updates (including SMS/SML-relevant docs).
46+
- Runtime and tooling updates to enforce single-slash canonical paths.
47+
- Test coverage for parse/normalize/reject behavior.
48+
- Migration note for existing `://`-based content.
49+
50+
## Acceptance Criteria
51+
- All Forge-owned resource URI outputs are canonical single-slash (`res:/`, `appRes:/`, `user:/`).
52+
- No Forge-owned parser/resolver emits `res://`, `appRes://`, or `user://`.
53+
- Legacy double-slash inputs follow documented compatibility behavior and never bypass security checks.
54+
- Managed/native and editor/runtime path behavior are consistent for covered cases.
55+
56+
## Dependencies
57+
- Depends on:
58+
- `CWUP/tasks/sms_language_spec_2026_native.md`
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
using Runtime.Sml;
2+
using Xunit;
3+
4+
namespace SMLCore.Tests;
5+
6+
public class MarkdownParserTests
7+
{
8+
[Fact]
9+
public void Parse_WithHeading_CreatesHeadingBlock()
10+
{
11+
var result = MarkdownParser.Parse("# Title");
12+
13+
var block = Assert.Single(result.Blocks);
14+
Assert.Equal(MarkdownBlockKind.Heading, block.Kind);
15+
Assert.Equal(1, block.HeadingLevel);
16+
Assert.Equal("Title", block.Text);
17+
}
18+
19+
[Fact]
20+
public void Parse_WithPropertyBlock_BindsToPreviousElement()
21+
{
22+
const string markdown = """
23+
![Alt](img.png)
24+
{
25+
align: center
26+
size: 320, 240
27+
}
28+
""";
29+
30+
var result = MarkdownParser.Parse(markdown);
31+
32+
var block = Assert.Single(result.Blocks);
33+
Assert.Equal(MarkdownBlockKind.Image, block.Kind);
34+
Assert.Equal("center", block.Properties["align"]);
35+
Assert.Equal("320, 240", block.Properties["size"]);
36+
}
37+
38+
[Fact]
39+
public void Parse_WithHardLineBreak_KeepsNewlineInParagraph()
40+
{
41+
const string markdown = "Line one \nLine two";
42+
43+
var result = MarkdownParser.Parse(markdown);
44+
45+
var block = Assert.Single(result.Blocks);
46+
Assert.Equal(MarkdownBlockKind.Paragraph, block.Kind);
47+
Assert.Equal("Line one\nLine two", block.Text);
48+
}
49+
50+
[Fact]
51+
public void Parse_WithHtml_KeepsHtmlAsPlainText()
52+
{
53+
const string markdown = "<div>Hello</div>";
54+
55+
var result = MarkdownParser.Parse(markdown);
56+
57+
var block = Assert.Single(result.Blocks);
58+
Assert.Equal(MarkdownBlockKind.Paragraph, block.Kind);
59+
Assert.Equal("<div>Hello</div>", block.Text);
60+
}
61+
}

0 commit comments

Comments
 (0)