1#!/bin/sh 2. "${srcdir=.}/init.sh"; path_prepend_ . ../src 3 4# Test of JavaScript support. 5# Playing with regex and division operator 6 7cat <<\EOF > xg-js-2.js 8// RegExp literals containing string quotes must not desync the parser 9var d = 1 / 2 / 4; 10var s = " x " + /^\d/.match("0815").replace(/[a-z]/g, '@'); 11var s1 = /"/.match(_("RegExp test string #1")); 12var s2 = /'/.match(_("RegExp test string #2")); 13var s3 = /['a-b]/.match(_('RegExp test string #3')); 14var s4 = /["a-b]/.match(_('RegExp test string #4')); 15var s5 = /[a-b']/.match(_('RegExp test string #5')); 16var s6 = /[a-b"]/.match(_('RegExp test string #6')); 17var c = 35 / 2 / 8 + _("RegExp test string #7").length / 32.0; 18var sizestr = Math.round(size/1024*factor)/factor+_("RegExp test string #8"); 19var cssClassType = attr.type.replace(/^.*\//, _('RegExp test string #9')).replace(/\./g, '-'); 20var lookup = lookuptable[idx]/factor+_("RegExp test string #10"); 21function doit() { 22 return /\./.match(_("RegExp test string #11")); 23} 24if (false) 25 /foo/.match(_("RegExp test string #12")); 26else 27 /foo/.match(_("RegExp test string #13")); 28var s7 = /a\/\f\r\n\t\v\0\b\s\S\w\W\d\D\b\Bb/.test(_("RegExp test string #14")); 29var s8 = /(?=(a+))a*b\1/.exec(_("RegExp test string #15")); 30var s9 = /_("a+")/.exec(_("RegExp test string #16")); 31EOF 32 33: ${XGETTEXT=xgettext} 34${XGETTEXT} --add-comments --no-location -o xg-js-2.tmp xg-js-2.js 2>xg-js-2.err 35test $? = 0 || { cat xg-js-2.err; Exit 1; } 36func_filter_POT_Creation_Date xg-js-2.tmp xg-js-2.pot 37 38cat <<\EOF > xg-js-2.ok 39# SOME DESCRIPTIVE TITLE. 40# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER 41# This file is distributed under the same license as the PACKAGE package. 42# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. 43# 44#, fuzzy 45msgid "" 46msgstr "" 47"Project-Id-Version: PACKAGE VERSION\n" 48"Report-Msgid-Bugs-To: \n" 49"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 50"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" 51"Language-Team: LANGUAGE <LL@li.org>\n" 52"Language: \n" 53"MIME-Version: 1.0\n" 54"Content-Type: text/plain; charset=CHARSET\n" 55"Content-Transfer-Encoding: 8bit\n" 56 57msgid "RegExp test string #1" 58msgstr "" 59 60msgid "RegExp test string #2" 61msgstr "" 62 63msgid "RegExp test string #3" 64msgstr "" 65 66msgid "RegExp test string #4" 67msgstr "" 68 69msgid "RegExp test string #5" 70msgstr "" 71 72msgid "RegExp test string #6" 73msgstr "" 74 75msgid "RegExp test string #7" 76msgstr "" 77 78msgid "RegExp test string #8" 79msgstr "" 80 81msgid "RegExp test string #9" 82msgstr "" 83 84msgid "RegExp test string #10" 85msgstr "" 86 87msgid "RegExp test string #11" 88msgstr "" 89 90msgid "RegExp test string #12" 91msgstr "" 92 93msgid "RegExp test string #13" 94msgstr "" 95 96msgid "RegExp test string #14" 97msgstr "" 98 99msgid "RegExp test string #15" 100msgstr "" 101 102msgid "RegExp test string #16" 103msgstr "" 104EOF 105 106: ${DIFF=diff} 107${DIFF} xg-js-2.ok xg-js-2.pot 108result=$? 109 110exit $result 111