git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v2 2/4] t4034: add tests for javascript word literals

From
DFDerick W. de M. Frias <derick.william.moraes@gmail.com>
Date
Jun 23, 2025, 06:35 UTC
Message-ID
<20250623090538.154858-3-derick.william.moraes@gmail.com>
In-Reply-To
<20250623090538.154858-1-derick.william.moraes@gmail.com>
Add tests for javascript word pattern.
Signed-off-by: Derick W. de M. Frias <derick.william.moraes@gmail.com>
---
 t/t4034-diff-words.sh     |  1 +
 t/t4034/javascript/expect | 26 ++++++++++++++++++++++----
 t/t4034/javascript/post   | 16 ++++++++++++----
 t/t4034/javascript/pre    | 16 ++++++++++++----
 4 files changed, 47 insertions(+), 12 deletions(-)
diff --git a/t/t4034-diff-words.sh b/t/t4034-diff-words.sh
index 0be647c2fb..5bf1294f27 100755
--- a/t/t4034-diff-words.sh
+++ b/t/t4034-diff-words.sh
@@ -328,6 +328,7 @@ test_language_driver dts
 test_language_driver fortran
 test_language_driver html
 test_language_driver java
+test_language_driver javascript
 test_language_driver kotlin
 test_language_driver matlab
 test_language_driver objc
diff --git a/t/t4034/javascript/expect b/t/t4034/javascript/expect
index cc5e1253f6..98b057c48a 100644
--- a/t/t4034/javascript/expect
+++ b/t/t4034/javascript/expect
@@ -43,12 +43,30 @@
 <GREEN>0B0010<RESET>
 <GREEN>0b0001_1101_0011<RESET>
 <GREEN>0b11111111111111000011111111111111111n<RESET>
+// Floating point and exponent notation<RESET>
+<RED>3.14<RESET>
+<RED>0.5<RESET>
+<RED>1.23e3<RESET>
+<RED>4.56e-2<RESET>
+<RED>7.89E4<RESET>
+<RED>0.12E-1<RESET>
+<RED>5e2<RESET>
+<RED>7e-3<RESET>
+<RED>6E3<RESET>
+<RED>9E-3<RESET>
+<GREEN>3.15<RESET>
+<GREEN>0.75<RESET>
+<GREEN>1.23e4<RESET>
+<GREEN>4.96e-3<RESET>
+<GREEN>7.89E8<RESET>
+<GREEN>0.11E-2<RESET>
+<GREEN>6e3<RESET>
+<GREEN>8e-2<RESET>
+<GREEN>7E4<RESET>
+<GREEN>2E-6<RESET>
 // punctuations<RESET>
-{<RED>a<RESET><GREEN>b<RESET>} (<RED>a<RESET><GREEN>b<RESET>)
-<RED>a<RESET><GREEN>b<RESET>;
-[<RED>1,<RESET>2<GREEN>,3<RESET>]
 [<RED>1, 2,<RESET> ...<RED>params<RESET><GREEN>params_v2<RESET> ]
 a<RED><=<RESET><GREEN>=<RESET>2 a<RED>>=<RESET><GREEN>=<RESET>2 a<RED>==<RESET><GREEN>=<RESET>2 a<RED>!=<RESET><GREEN>=<RESET>2 a<RED>===<RESET><GREEN>=<RESET>2 a<RED>!==<RESET><GREEN>=<RESET>2 a<RED>^=<RESET><GREEN>=<RESET>2 a<RED>=><RESET><GREEN>=<RESET>2
 a<RED>+=<RESET><GREEN>-=<RESET>b a<RED>*=<RESET><GREEN>%=<RESET>b a<RED>**=<RESET><GREEN>&&=<RESET>b a<RED>||=<RESET><GREEN>|=<RESET>b
 b<RED>+<RESET><GREEN>-<RESET>c a<RED>--<RESET><GREEN>++<RESET> a<RED>>><RESET><GREEN><<<RESET>b a<RED>>>><RESET><GREEN>>>>=<RESET>b a<RED>>>=<RESET><GREEN><<=<RESET>b
-a<RED>&&<RESET><GREEN>&<RESET>b a<RED>||<RESET><GREEN>|<RESET>b a<RED>&&=<RESET><GREEN>??=<RESET>b
\ No newline at end of file
+a<RED>&&<RESET><GREEN>&<RESET>b a<RED>||<RESET><GREEN>|<RESET>b a<RED>&&=<RESET><GREEN>??=<RESET>b
diff --git a/t/t4034/javascript/post b/t/t4034/javascript/post
index 9d66c9dc91..12165198ad 100644
--- a/t/t4034/javascript/post
+++ b/t/t4034/javascript/post
@@ -22,12 +22,20 @@
 0B0010
 0b0001_1101_0011
 0b11111111111111000011111111111111111n
+// Floating point and exponent notation
+3.15
+0.75
+1.23e4
+4.96e-3
+7.89E8
+0.11E-2
+6e3
+8e-2
+7E4
+2E-6
 // punctuations
-{b} (b)
-b;
-[2,3]
 [ ...params_v2 ]
 a=2 a=2 a=2 a=2 a=2 a=2 a=2 a=2
 a-=b a%=b a&&=b a|=b
 b-c a++ a<<b a>>>=b a<<=b
-a&b a|b a??=b
\ No newline at end of file
+a&b a|b a??=b
diff --git a/t/t4034/javascript/pre b/t/t4034/javascript/pre
index 9876514042..43d5908e09 100644
--- a/t/t4034/javascript/pre
+++ b/t/t4034/javascript/pre
@@ -22,12 +22,20 @@
 0B0110
 0b0001_1001_0011
 0b1111111111111111111111111111111111111n
+// Floating point and exponent notation
+3.14
+0.5
+1.23e3
+4.56e-2
+7.89E4
+0.12E-1
+5e2
+7e-3
+6E3
+9E-3
 // punctuations
-{a} (a)
-a;
-[1,2]
 [ 1, 2, ...params ]
 a<=2 a>=2 a==2 a!=2 a===2 a!==2 a^=2 a=>2
 a+=b a*=b a**=b a||=b
 b+c a-- a>>b a>>>b a>>=b
-a&&b a||b a&&=b
\ No newline at end of file
+a&&b a||b a&&=b
-- 
2.50.0.rc0.62.g658f0ae201.dirty
Previous: Derick W. de M. FriasNext: Derick W. de M. Frias
Message 6 of 11 in “userdiff: add javascript diff driver”
  1. 0/1 userdiff: add javascript diff driverDerick W. de M. Frias, Jun 4, 2025
  2. 1/1 userdiff: add javascript diff driverDerick W. de M. Frias, Jun 4, 2025
  3. D. Ben KnobleJun 4, 2025
  4. Johannes SixtJun 5, 2025
  5. 0/4 diff: create pattern for javascript languageDerick W. de M. Frias, Jun 23, 2025
  6. 2/4 t4034: add tests for javascript word literalsDerick W. de M. Frias, Jun 23, 2025
  7. 3/4 t4018: add tests for recognizing javascript function syntaxDerick W. de M. Frias, Jun 23, 2025
  8. 1/4 userdiff: add javascript diff driverDerick W. de M. Frias, Jun 23, 2025
  9. Junio C HamanoJun 23, 2025
  10. 4/4 t4018: add tests for javascript export type function declarationsDerick W. de M. Frias, Jun 23, 2025
  11. Johannes SixtJun 26, 2025

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.