-
-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
$mol_view_tree2_to_js prop name fixes, number fix
- Loading branch information
Showing
11 changed files
with
118 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
namespace $ { | ||
|
||
$mol_test({ | ||
'wrong order'($) { | ||
$mol_assert_fail(() => { | ||
$mol_view_tree2_prop_parts('some_bla?*') | ||
}) | ||
}, | ||
|
||
'empty'($) { | ||
$mol_assert_fail(() => { | ||
$mol_view_tree2_prop_parts('') | ||
}) | ||
}, | ||
|
||
'prop with index'($) { | ||
const parts = $mol_view_tree2_prop_parts('some_bla*') | ||
$mol_assert_equal(parts.name, 'some_bla') | ||
$mol_assert_equal(parts.key, '*') | ||
$mol_assert_equal(parts.next, '') | ||
}, | ||
|
||
'prop with index and value'($) { | ||
const parts = $mol_view_tree2_prop_parts('some_bla*?') | ||
$mol_assert_equal(parts.name, 'some_bla') | ||
$mol_assert_equal(parts.key, '*') | ||
$mol_assert_equal(parts.next, '?') | ||
}, | ||
|
||
'legacy indexed'($) { | ||
const parts = $mol_view_tree2_prop_parts('Some*default') | ||
$mol_assert_equal(parts.name, 'Some') | ||
$mol_assert_equal(parts.key, '*') | ||
$mol_assert_equal(parts.next, '') | ||
}, | ||
|
||
'legacy indexed value'($) { | ||
const parts = $mol_view_tree2_prop_parts('Some*k?v') | ||
$mol_assert_equal(parts.name, 'Some') | ||
$mol_assert_equal(parts.key, '*') | ||
$mol_assert_equal(parts.next, '?') | ||
} | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,12 @@ | ||
namespace $ { | ||
export function $mol_view_tree2_prop_parts( prop: $mol_tree2 ) { | ||
return [ ...prop.type.matchAll( $mol_view_tree2_prop_signature ) ][0].groups! | ||
export function $mol_view_tree2_prop_parts( prop: string ) { | ||
const groups = [ ...prop.matchAll( $mol_view_tree2_prop_signature ) ][0]?.groups | ||
if (! groups) throw new Error(`${$mol_view_tree2_prop_signature} not matched: ${prop}`) | ||
|
||
return { | ||
name: groups.name, | ||
key: groups.key ? '*' : '', | ||
next: groups.next ? '?' : '' | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 2 additions & 1 deletion
3
view/tree2/to/js/test/ex/simple_default_indexed_channel.view.tree
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
$mol_view_tree2_to_js_test_ex_simple_default_indexed_channel_foo $mol_view | ||
a*? null | ||
a_b*? 0 | ||
legacy*k?v 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
$mol_view_tree2_to_js_test_ex_simple_nan_foo $mol_view | ||
a NaN | ||
b +NaN | ||
c -NaN | ||
d +Infinity | ||
e -Infinity |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters